Upgrade OJS 3.0.0 -> 3.0.1 fail (Duplicate entry)

I tried upgrad from 3.0.0 to 3.0.1 using:
Full Package for the latest Ojs code

Look:

$ php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 3.0.1.0]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/log.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/submissionFiles.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/genres.xml]
[schema: lib/pkp/xml/schema/gifts.xml]
[schema: lib/pkp/xml/schema/mutex.xml]
[schema: lib/pkp/xml/schema/tombstone.xml]
[schema: lib/pkp/xml/schema/rolesAndUserGroups.xml]
[schema: lib/pkp/xml/schema/metrics.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/libraryFiles.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]

[code: Installer Installer::setFileUploader]

[code: Installer Installer::setFileName]
[data: dbscripts/xml/upgrade/3.0.1_update.xml]
[data: dbscripts/xml/upgrade/3.0.0_postupgrade_galley_files.xml]
[data: dbscripts/xml/upgrade/3.0.0_postupgrade_metrics.xml]

[code: Installer Installer::localizeIssueCoverImages]

[code: Installer Installer::localizeArticleCoverImages]
[data: dbscripts/xml/upgrade/3.0.0_issue_settings.xml]
ERROR: Upgrade failed: DB: Duplicate entry ‘104-pt_BR-coverImage’ for key ‘issue_settings_pkey’

I’m trying to discover which registry is duplicated, but it’s not working.
Some idea to resolve my problem?

It was trying to run this update:

UPDATE issue_settings SET setting_name = ‘coverImage’ WHERE setting_name = ‘fileName’

I resolved this issue deleting just one registry at table ‘issue_settings’.

I believe this happened because the id of this table isn’t PRIMARY KEY!

Hi @murilodbva

After the 3.0.1 release there was one more patch for cover images, could you please apply it before doing the upgrade, s. Fix SQL statements by bozana · Pull Request #1130 · pkp/ojs · GitHub

Thanks a lot!
Bozana

Hi @bozana
About your tip,
do I need to change my ojs/classes/install/Upgrade.inc.php
to this code https://github.com/bozana/ojs/blob/0a7da62cee4ef53d6c8a50ae5b96c2c7dcf210f0/classes/install/Upgrade.inc.php
And then to run?
If yes, how to run?

I resolved this by editing the update script “dbscripts/xml/upgrade/3.0.0_issue_settings.xml
I added a delete line (with repeted ids) before SQL “UPDATE issue_settings SET setting_name = ‘coverImage’ …

To discover what ids I needed to remove, used this sql:

SELECT issue_id FROM issue_settings WHERE locale LIKE ‘pt_BR’ AND setting_name LIKE ‘coverImage’ AND issue_id IN ( SELECT issue_id FROM issue_settings WHERE locale LIKE ‘pt_BR’ AND setting_name LIKE ‘fileName’);

So my delete line in script stayed this way:

DELETE FROM issue_settings WHERE locale LIKE ‘pt_BR’ AND setting_name LIKE ‘coverImage’ AND issue_id IN (‘29’,‘31’,‘32’,‘33’,‘34’,‘35’,‘58’,‘70’,‘96’,‘97’,‘98’,‘99’,‘104’,‘105’,‘106’,‘109’,‘112’,‘113’,‘114’,‘115’,‘123’,‘124’,‘125’,‘134’,‘136’,‘138’,‘141’,‘145’,‘146’,‘148’,‘149’,‘151’,‘152’,‘157’,‘159’,‘163’,‘164’)