We have a OJS installation in version 220.127.116.11 but we started in 2.3.3 a few years ago and we keep it up to date.
Recently I tried performing the process of upgrading from OJS 18.104.22.168 to version 3.0.2
The first problem I encountered was this:
ERROR: Upgrade failed: DB: Duplicate entry '3358-3-1' for key 'review_rounds_submission_id_stage_id_round_pkey'
I put the configuration in debug mode for database and saw that the last commands are:
(mysql): 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)
(mysql): UPDATE review_rounds SET stage_id=3
Is this latest UPDATE without the WHERE clause really right?
Searching here on the forum I found the response of someone who recommended running this in the database:
CREATE TABLE review_rounds_old SELECT * FROM review_rounds;
DELETE FROM review_rounds WHERE review_round_id NOT IN (SELECT MIN(review_round_id) FROM review_rounds_old GROUP BY submission_id, round);
DROP TABLE review_rounds_old;
I ran the above commands and running the update again and the duplicate entry error did not occur anymore. But another error occurred:
ERROR: Upgrade failed: DB: Duplicate entry 'defaultthemeplugin-0-enabled' for key 'plugin_settings_pkey'
And to pass from this point I had to comment the following lines in the dbscripts/xml/upgrade /3.0.0_update.xml file:
<sql><!-- Make the default theme plugin active for all journals and the site. -->
<query>INSERT INTO plugin_settings (plugin_name, setting_name, setting_value, setting_type, context_id) VALUES ('defaultthemeplugin', 'enabled', '1', 'bool', 0)</query>
<query>INSERT INTO plugin_settings (plugin_name, setting_name, setting_value, setting_type, context_id) SELECT 'defaultthemeplugin', 'enabled', '1', 'bool', journal_id FROM journals</query>
<query>INSERT INTO site_settings (setting_name, setting_value, setting_type) VALUES ('themePluginPath', 'default', 'string')</query>
<query>INSERT INTO journal_settings (setting_name, setting_value, setting_type, journal_id) SELECT 'themePluginPath', 'default', 'string', journal_id FROM journals</query>
Then I started to run the update command and again another error:
<H1> DB Error: Data too long for column 'label' at row 1 </ h1> ojs2: DB Error: Data too long for column 'label' at row 1
I saw that this problem is related to the table submission_galleys that is created label column with size 255 on file dbscripts/xml/ojs_schema.xml
I did some searches in our base and in our ojs and saw that this table is filled by the form
GALLEY -> EDIT A LAYOUT GALLEY that has field 'label' but the query also uses the form EDIT A SUPPLEMENTARY FILE -> SUPPLEMENTARY FILE METADATA that instead of 'label' has field 'title'.
So to get past this problem I had to change the schema so that the label field was 512, so it could hold the biggest title of my base.
By doing these interventions the upgrade process ends but I can not access the administration menu, the options do not appear, and there are problems with the theme used.
So anyone else had to deal with this problem?
Can such database interventions be a problem for future updates?
Thanks in advance!!!