INSERT INTO event_log (assoc_type, assoc_id, user_id, date_logged, ip_address, event_type, message, is_translated) SELECT log_id, article_id, user_id, date_logged, ip_address, event_type, message, 1 FROM article_event_log
INSERT INTO event_log_settings (log_id, setting_name, setting_value, setting_type) SELECT log_id, 'old_log_id', assoc_type, 'int' FROM event_log
INSERT INTO event_log_settings (log_id, setting_name, setting_value, setting_type) SELECT n.log_id, 'assoc_type', o.assoc_type, 'int' FROM event_log n, article_event_log o WHERE o.assoc_id IS NOT NULL AND o.assoc_id <> 0 AND n.assoc_type = o.log_id
INSERT INTO event_log_settings (log_id, setting_name, setting_value, setting_type) SELECT n.log_id, 'assoc_id', o.assoc_id, 'int' FROM event_log n, article_event_log o WHERE o.assoc_id IS NOT NULL AND o.assoc_id <> 0 AND n.assoc_type = o.log_id
UPDATE event_log SET assoc_type = 257
DROP TABLE article_event_log
UPDATE email_log SET assoc_type = 257
INSERT INTO plugin_settings (plugin_name, locale, journal_id, setting_name, setting_value, setting_type) SELECT 'doipubidplugin', '', js.journal_id, 'enabled', '1', 'bool' FROM journal_settings js LEFT JOIN plugin_settings ps ON js.journal_id = ps.journal_id AND ps.plugin_name = 'doipubidplugin' AND ps.setting_name = 'enabled' WHERE js.setting_name = 'doiPrefix' AND js.setting_value != '' AND ps.plugin_name IS NULL
INSERT INTO plugin_settings (plugin_name, locale, journal_id, setting_name, setting_value, setting_type) SELECT 'doipubidplugin', '', js.journal_id, 'enableArticleDoi', '1', 'bool' FROM journal_settings js LEFT JOIN plugin_settings ps ON js.journal_id = ps.journal_id AND ps.plugin_name = 'doipubidplugin' AND ps.setting_name = 'enableArticleDoi' WHERE js.setting_name = 'doiPrefix' AND js.setting_value != '' AND ps.plugin_name IS NULL
INSERT INTO plugin_settings(plugin_name, locale, journal_id, setting_name, setting_value, setting_type) SELECT 'doipubidplugin', '', journal_id, setting_name, setting_value, setting_type FROM journal_settings WHERE setting_name IN ('doiPrefix', 'doiSuffix')
INSERT INTO plugin_settings(plugin_name, locale, journal_id, setting_name, setting_value, setting_type) SELECT 'doipubidplugin', '', journal_id, 'doiArticleSuffixPattern', setting_value, setting_type FROM journal_settings WHERE setting_name = 'doiSuffixPattern'
DELETE FROM journal_settings WHERE setting_name IN ('doiPrefix', 'doiSuffix', 'doiSuffixPattern')
INSERT INTO site_settings (setting_name, setting_value, setting_type, locale) SELECT 'showThumbnail', 'true', 'bool', '' FROM mutex LEFT OUTER JOIN site_settings ON site_settings.setting_name = 'showThumbnail' WHERE mutex.i = 1 AND site_settings.setting_name IS NULL
INSERT INTO site_settings (setting_name, setting_value, setting_type, locale) SELECT 'showTitle', 'true', 'bool', '' FROM mutex LEFT OUTER JOIN site_settings ON site_settings.setting_name = 'showTitle' WHERE mutex.i = 1 AND site_settings.setting_name IS NULL
INSERT INTO site_settings (setting_name, setting_value, setting_type, locale) SELECT 'showDescription', 'true', 'bool', '' FROM mutex LEFT OUTER JOIN site_settings ON site_settings.setting_name = 'showDescription' WHERE mutex.i = 1 AND site_settings.setting_name IS NULL