DELETE FROM notifications WHERE type=16777224
DELETE FROM notifications WHERE type=16777225
DELETE FROM notifications WHERE type=16777232
DELETE FROM notifications WHERE type=16777220
DELETE FROM notifications WHERE type=16777222
DELETE FROM notifications WHERE type=16777223
DELETE FROM notifications WHERE type=16777234
DELETE FROM notifications WHERE type=16777235
DELETE FROM notifications WHERE type=268435476
UPDATE review_assignments SET stage_id=1 WHERE stage_id=0
UPDATE published_submissions SET date_published = NULL WHERE CONCAT(date_published) = '0000-00-00 00:00:00'
UPDATE published_submissions SET date_published = NULL WHERE CONCAT(date_published) = '0000-00-00 00:00:00'
UPDATE submission_files SET file_stage = '13' WHERE file_stage = '9'
UPDATE submission_files SET file_stage = '13' WHERE file_stage = '6'
UPDATE submission_files SET file_stage = '10' WHERE file_stage = '5'
UPDATE submission_files SET file_stage = '9' WHERE file_stage = '4'
UPDATE submission_files SET file_stage = '8000' WHERE file_stage = '3'
UPDATE submission_files SET file_stage = '4' WHERE file_stage = '2'
UPDATE submission_files SET file_stage = '2' WHERE file_stage = '1'
UPDATE submission_files SET file_stage = '1' WHERE file_stage = '7'
UPDATE submission_files SET file_stage = '3000' WHERE file_stage = '8'
UPDATE submission_files SET file_stage = '8' WHERE file_stage = '8000'
UPDATE submission_files SET file_stage = '3' WHERE file_stage = '3000'
UPDATE email_templates_default_data SET body=REPLACE(body, '{$journalTitle}', '{$contextName}'), subject=REPLACE(subject, '{$journalTitle}', '{$contextName}')
UPDATE email_templates_data SET body=REPLACE(body, '{$journalTitle}', '{$contextName}'), subject=REPLACE(subject, '{$journalTitle}', '{$contextName}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$journalName}', '{$contextName}'), subject=REPLACE(subject, '{$journalName}', '{$contextName}')
UPDATE email_templates_data SET body=REPLACE(body, '{$journalName}', '{$contextName}'), subject=REPLACE(subject, '{$journalName}', '{$contextName}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$journalUrl}', '{$contextUrl}'), subject=REPLACE(subject, '{$journalUrl}', '{$contextUrl}')
UPDATE email_templates_data SET body=REPLACE(body, '{$journalUrl}', '{$contextUrl}'), subject=REPLACE(subject, '{$journalUrl}', '{$contextUrl}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$articleTitle}', '{$submissionTitle}'), subject=REPLACE(subject, '{$articleTitle}', '{$submissionTitle}')
UPDATE email_templates_data SET body=REPLACE(body, '{$articleTitle}', '{$submissionTitle}'), subject=REPLACE(subject, '{$articleTitle}', '{$submissionTitle}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$articleId}', '{$submissionId}'), subject=REPLACE(subject, '{$articleId}', '{$submissionId}')
UPDATE email_templates_data SET body=REPLACE(body, '{$articleId}', '{$submissionId}'), subject=REPLACE(subject, '{$articleId}', '{$submissionId}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$articleAbstract}', '{$submissionAbstract}'), subject=REPLACE(subject, '{$articleAbstract}', '{$submissionAbstract}')
UPDATE email_templates_data SET body=REPLACE(body, '{$articleAbstract}', '{$submissionAbstract}'), subject=REPLACE(subject, '{$articleAbstract}', '{$submissionAbstract}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$weekLaterDate}', '{$responseDueDate}'), subject=REPLACE(subject, '{$weekLaterDate}', '{$responseDueDate}')
UPDATE email_templates_data SET body=REPLACE(body, '{$weekLaterDate}', '{$responseDueDate}'), subject=REPLACE(subject, '{$weekLaterDate}', '{$responseDueDate}')
UPDATE submission_files sf, genres g, submissions s SET sf.genre_id = g.genre_id WHERE g.entry_key = 'SUBMISSION' AND g.context_id = s.context_id AND s.submission_id = sf.submission_id
UPDATE submission_files sf, genres g, submissions s SET sf.genre_id = g.genre_id WHERE g.entry_key = 'SUBMISSION' AND g.context_id = s.context_id AND s.submission_id = sf.submission_id
UPDATE submission_files SET genre_id = g.genre_id FROM genres g, submissions s WHERE g.entry_key = 'SUBMISSION' AND g.context_id = s.context_id AND s.submission_id = submission_files.submission_id
UPDATE submission_files sf, genres g, submissions s, article_galleys_migration agm SET sf.genre_id = g.genre_id WHERE g.entry_key = 'STYLE' AND g.context_id = s.context_id AND s.submission_id = sf.submission_id AND sf.file_id = agm.style_file_id
UPDATE submission_files sf, genres g, submissions s, article_galleys_migration agm SET sf.genre_id = g.genre_id WHERE g.entry_key = 'STYLE' AND g.context_id = s.context_id AND s.submission_id = sf.submission_id AND sf.file_id = agm.style_file_id
UPDATE submission_files sf SET genre_id = g.genre_id FROM genres g, submissions s, article_galleys_migration agm WHERE g.entry_key = 'STYLE' AND g.context_id = s.context_id AND s.submission_id = sf.submission_id AND sf.file_id = agm.style_file_id
UPDATE submission_files sf, article_galleys_migration agm SET sf.assoc_type = 515, sf.assoc_id = agm.file_id WHERE sf.file_id = agm.style_file_id
UPDATE submission_files sf, article_galleys_migration agm SET sf.assoc_type = 515, sf.assoc_id = agm.file_id WHERE sf.file_id = agm.style_file_id
UPDATE submission_files sf SET assoc_type = 515, assoc_id = agm.file_id FROM article_galleys_migration agm WHERE sf.file_id = agm.style_file_id
UPDATE announcement_type_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE announcement_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE user_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE notification_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE email_templates_default_data SET locale='nb_NO' WHERE locale='no_NO'
UPDATE email_templates_data SET locale='nb_NO' WHERE locale='no_NO'
UPDATE controlled_vocab_entry_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE citation_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE metadata_description_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE filter_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE review_form_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE review_form_element_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE user_group_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE submission_file_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE author_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE data_object_tombstone_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE journal_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE section_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE issue_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE issue_galleys SET locale='nb_NO' WHERE locale='no_NO'
UPDATE issue_galley_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE submissions SET locale='nb_NO' WHERE locale='no_NO'
UPDATE submission_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE submission_galleys SET locale='nb_NO' WHERE locale='no_NO'
UPDATE submission_galley_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE rt_versions SET locale='nb_NO' WHERE locale='no_NO'
UPDATE subscription_type_settings SET locale='nb_NO' WHERE locale='no_NO'
UPDATE submissions SET status=4 WHERE status=0
UPDATE email_templates_default_data SET body=REPLACE(body, '{$submissionCopyeditingUrl}', '{$submissionUrl}')
UPDATE email_templates_data SET body=REPLACE(body, '{$submissionCopyeditingUrl}', '{$submissionUrl}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$layoutEditorName}', '{$participantName}')
UPDATE email_templates_data SET body=REPLACE(body, '{$layoutEditorName}', '{$participantName}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$layoutEditorUsername}', '{$participantUsername}')
UPDATE email_templates_data SET body=REPLACE(body, '{$layoutEditorUsername}', '{$participantUsername}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$copyeditorName}', '{$participantName}')
UPDATE email_templates_data SET body=REPLACE(body, '{$copyeditorName}', '{$participantName}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$copyeditorUsername}', '{$participantUsername}')
UPDATE email_templates_data SET body=REPLACE(body, '{$copyeditorUsername}', '{$participantUsername}')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$editorialContactName}', 'Editors') WHERE locale = 'en_US' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_data SET body=REPLACE(body, '{$editorialContactName}', 'Editors') WHERE locale = 'en_US' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$editorialContactName}', 'Herausgeber/innen') WHERE locale = 'de_DE' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_data SET body=REPLACE(body, '{$editorialContactName}', 'Herausgeber/innen') WHERE locale = 'de_DE' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$editorialContactName}', 'Επιμελητές') WHERE locale = 'el_GR' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_data SET body=REPLACE(body, '{$editorialContactName}', 'Επιμελητές') WHERE locale = 'el_GR' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$editorialContactName}', 'Editores') WHERE locale = 'es_ES' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_data SET body=REPLACE(body, '{$editorialContactName}', 'Editores') WHERE locale = 'es_ES' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$editorialContactName}', 'Éditeurs') WHERE locale = 'fr_CA' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_data SET body=REPLACE(body, '{$editorialContactName}', 'Éditeurs') WHERE locale = 'fr_CA' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_default_data SET body=REPLACE(body, '{$editorialContactName}', 'Editores') WHERE locale = 'pt_BR' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
UPDATE email_templates_data SET body=REPLACE(body, '{$editorialContactName}', 'Editores') WHERE locale = 'pt_BR' AND email_key IN ('REVIEW_CONFIRM', 'REVIEW_DECLINE')
INSERT INTO plugin_settings (plugin_name, setting_name, setting_value, setting_type, context_id) VALUES ('defaultthemeplugin', 'enabled', '1', 'bool', 0)
INSERT INTO plugin_settings (plugin_name, setting_name, setting_value, setting_type, context_id) SELECT 'defaultthemeplugin', 'enabled', '1', 'bool', journal_id FROM journals
INSERT INTO site_settings (setting_name, setting_value, setting_type) VALUES ('themePluginPath', 'default', 'string')
INSERT INTO journal_settings (setting_name, setting_value, setting_type, journal_id) SELECT 'themePluginPath', 'default', 'string', journal_id FROM journals
UPDATE event_log SET message='submission.event.submissionSubmitted' WHERE message='log.author.submitted'
UPDATE submissions SET stage_id=3 WHERE submission_id IN (SELECT DISTINCT submission_id FROM review_assignments)
UPDATE submissions SET stage_id=3 WHERE stage_id = 1 AND submission_id IN (SELECT DISTINCT submission_id FROM review_rounds)
UPDATE submissions SET stage_id=4 WHERE submission_id IN (SELECT e1.submission_id FROM edit_decisions e1 LEFT JOIN edit_decisions e2 ON (e2.edit_decision_id > e1.edit_decision_id AND e2.submission_id = e1.submission_id) WHERE e2.edit_decision_id IS NULL AND e1.decision = 1)
UPDATE review_rounds SET stage_id=3
UPDATE review_assignments SET stage_id=3
UPDATE review_assignments ra, review_rounds rr SET ra.review_round_id = rr.review_round_id WHERE ra.submission_id = rr.submission_id AND ra.round = rr.round
UPDATE review_assignments ra, review_rounds rr SET ra.review_round_id = rr.review_round_id WHERE ra.submission_id = rr.submission_id AND ra.round = rr.round
UPDATE review_assignments SET review_round_id=rr.review_round_id FROM review_rounds rr WHERE rr.round = review_assignments.round AND rr.submission_id = review_assignments.submission_id
INSERT INTO review_round_files (submission_id, review_round_id, stage_id, file_id, revision) SELECT afm.article_id, rr.review_round_id, 3, afm.file_id, afm.revision FROM article_files_migration afm, articles_migration am, review_rounds rr WHERE am.review_file_id = afm.file_id AND rr.submission_id = afm.article_id AND rr.round = afm.round
INSERT INTO review_round_files (submission_id, review_round_id, stage_id, file_id, revision) SELECT afm.article_id, rr.review_round_id, 3, afm.file_id, afm.revision FROM article_files_migration afm, articles_migration am, review_rounds rr WHERE am.revised_file_id = afm.file_id AND rr.submission_id = afm.article_id AND rr.round = afm.round
INSERT INTO review_files (review_id, file_id) SELECT DISTINCT ra.review_id, afm.file_id FROM article_files_migration afm, articles_migration am, review_assignments ra WHERE ra.submission_id = am.article_id AND am.review_file_id = afm.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=2 WHERE am.submission_file_id=sf.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=2 WHERE am.submission_file_id=sf.file_id
UPDATE submission_files SET file_stage=2 FROM articles_migration am WHERE am.submission_file_id=submission_files.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=4 WHERE am.review_file_id=sf.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=4 WHERE am.review_file_id=sf.file_id
UPDATE submission_files SET file_stage=4 FROM articles_migration am WHERE am.review_file_id=submission_files.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=15 WHERE am.revised_file_id=sf.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=15 WHERE am.revised_file_id=sf.file_id
UPDATE submission_files SET file_stage=15 FROM articles_migration am WHERE am.revised_file_id=submission_files.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=7 WHERE am.editor_file_id=sf.file_id
UPDATE submission_files sf, articles_migration am SET sf.file_stage=7 WHERE am.editor_file_id=sf.file_id
UPDATE submission_files SET file_stage=7 FROM articles_migration am WHERE am.editor_file_id=submission_files.file_id
UPDATE submission_files SET file_stage=10 WHERE file_id IN (SELECT file_id FROM submission_galleys)
UPDATE submission_files SET file_stage=17 WHERE file_id IN (SELECT style_file_id FROM article_galleys_migration)
DELETE FROM scheduled_tasks WHERE class_name = 'classes.tasks.OpenAccessNotification'
DELETE FROM scheduled_tasks WHERE class_name = 'classes.tasks.SubscriptionExpiryReminder'
DELETE FROM filter_groups WHERE symbolic IN ('citation=>nlm30', 'isbn=>nlm30-element-citation', 'nlm30-article-xml=>nlm23-article-xml', 'nlm30-element-citation=>isbn', 'nlm30-element-citation=>nlm30-element-citation', 'nlm30-element-citation=>nlm30-xml', 'nlm30-element-citation=>plaintext', 'nlm30=>citation', 'plaintext=>nlm30-element-citation', 'submission=>nlm23-article-xml', 'submission=>nlm30-article-xml', 'submission=>reference-list')