SQL that disables old unreviewed files to fix editor queue (bug 638307)

This commit is contained in:
Kumar McMillan 2011-03-10 12:34:13 -06:00
Родитель bbc958db3d
Коммит eacfec63ca
1 изменённых файлов: 22 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,22 @@
-- Disables old, unreviewed versions so they are no longer in the review
-- queues. See bug 638307
-- This is a historic data fix. The production fix was done for bug 630063 in
-- https://github.com/jbalogh/zamboni/commit/3a7d072
UPDATE files
-- Change the file to STATUS_DISABLED if it was STATUS_UNREVIEWED
SET status=5 WHERE status=1 AND EXISTS (
SELECT v.id
FROM versions v
JOIN addons a on (a.id = v.addon_id)
LEFT JOIN versions as newer_v on (newer_v.addon_id = a.id AND
newer_v.created > v.created)
WHERE
v.id = files.version_id
-- Make sure we are only updating *old* versions
AND newer_v.id IS NOT NULL
-- Make sure the file is for a preliminary or pending addon.
-- (STATUS_PUBLIC, STATUS_LITE, STATUS_UNREVIEWED,
-- STATUS_DISABLED)
AND a.status in (4, 8, 1, 5));