Upgrade Database Failed OJS 3.1.2.4 to 3.2

Hi, anyone can help me understanding error below when I trying to upgrade database from OJS 3.1.2.4 to 3.2

ERROR: Upgrade failed: DB: Duplicate entry '92-7' for key 'citations_publication_seq'

Anotasi%202020-03-14%20115317

Server Information

Setting Name Setting Value
OS platform Linux
PHP version 7.3.15
Apache version Apache
Database driver mysqli
Database server version 10.0.38-MariaDB

Hi @andrewdion04,

See this related thread: OJS3.2 Upgrade Error - Please help - #9 by klausru

Would you be willing to privately send me a copy of your database (anonymized as needed)?

Regards,
Alec Smecher
Public Knowledge Project Team

I tried twice with the same error.

Thanks, @andrewdion04! See Upgrade error: Duplicate entry 'xxx-yyy' for key 'citations_publication_seq' · Issue #5626 · pkp/pkp-lib · GitHub for a solution. This will be released in OJS 3.2.0-1, which we expect to publish later this week.

Regards,
Alec Smecher
Public Knowledge Project Team

Yesss, thank you. I’ll try.

I triying to update database from 3.1.2-4 to 3.2.0
I obtained the same error:
Query failed. Duplicate entry ‘1323-1’ for key ‘citations_publication_seq’

Proposed solution:
I changed the file 3.2.0_versioning.xml. I drop the unique index before updating citations table and I add the same index just the updating is finished.

After this operation, I obtain no duplicated keys.

linea 163

ALTER TABLE citations DROP INDEX citations_publication_seq

	<query>
		UPDATE citations as c
		SET c.publication_id = (
			SELECT s.current_publication_id
			FROM submissions as s
			LEFT JOIN temp_citations as tc
				ON s.submission_id = tc.submission_id
			WHERE c.citation_id = tc.citation_id
		)
	</query>

    <query>
            ALTER TABLE citations ADD  UNIQUE INDEX citations_publication_seq  (publication_id, seq)
    </query>

Sorry!
file 3.2.0_versioning.xml
line 163

ALTER TABLE citations DROP INDEX citations_publication_seq


UPDATE citations as c
SET c.publication_id = (
SELECT s.current_publication_id
FROM submissions as s
LEFT JOIN temp_citations as tc
ON s.submission_id = tc.submission_id
WHERE c.citation_id = tc.citation_id
)


ALTER TABLE citations ADD UNIQUE INDEX citations_publication_seq (publication_id, seq)

Hi all,

See OJS3.2 Upgrade Error - Please help - #10 by asmecher for a fix.

Regards,
Alec Smecher
Public Knowledge Project Team