I know this issue or very similar has been posted to the Forum in the past but I can not get anything out from the answers given.
I’m trying to update OJS from version 2.4.5 to 2.4.8. I am in Ubuntu 18.04 with PHP 5.6.40, MariaDB 10.3
I’ve followed the steps given in the PKP upgrade recipie
Unpack the tar 2.4.8 version in a new directory inside apache web root
tar xzf ojs-2.4.8-4.tar.gz
Then I copy config.inc.php and public directory from the previous version. (ojs_files was outside of this directory)
Before upgrading the database, everything seems to work OK, without problems
Then I put installed = Off in config.inc.php
php tools/upgrade.php check report:
Code version: 184.108.40.206
Database version: 220.127.116.11
Latest version: 18.104.22.168
Database version is older than code version
Run “tools/upgrade.php upgrade” to update
Then I run php tools/upgrade.php upgrade and it give the following error when processing ojs_schema.xml
ERROR: Upgrade failed: DB: Incorrect table definition; there can be only one auto column and it must be defined as a key
I have reviewed ojs_schema.xml file and all AUTOINCREMENT tags have a PRIMARY KEY tag in the same field.
I have review the SQL file with the backup of database and all tables that have an autoincrement field have also a PRIMARY KEY with this field. So I do not know what this error means.
Reimporting de database does not work.
Have you resolved this issue? I’m facing the same one. Though the ojs_schema.xml have both tags “KEY” and “AUTOINCREMENT”, I can’t see why I still getting “Incorrect table definition; there can be only one auto column and it must be defined as a key”. Tried to take a look at adodb-xmlschema.inc.php but got no clue.
I’m trying to update my database from 2.3.7 to 2.4.8-5.
First error I got was this one on “review_rounds”, resolved just adding the review_round_id (autoincrement AND pk) after drop/create/restore database and running the upgrade again. Now I’m getting the same error in “published_articles” but the difference is huge between the 2.3.7 DB and the schema in the XML, and I’m afraid of messing something up and losing data.
To resolve the error with review_rounds, did you add the review_round_id in the OJS schema XML files or in the database?
In the database.
Possibly it’s not the right approach.
It already exists in lib/pkp/xml/schema/reviews.xml as follows:
<field name="review_round_id" type="I8">
Tried following what Database Debug was outputting right before the “incorrect table definition” of “published_articles” and executed them after drop/create/restore, and the include of “review_round_id” as well, and ran the upgrade, got another error:
ERROR: Upgrade failed: DB: ##installer.installParseDBFileError##
What I executed in MySQL after the restore:
ALTER TABLE review_rounds ADD review_round_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY;
DROP INDEX published_articles_article_id ON published_articles;
DROP INDEX published_articles_issue_id ON published_articles;
DROP INDEX published_articles_public_article_id ON published_articles;
ALTER TABLE published_articles DROP COLUMN `pub_id`;
ALTER TABLE published_articles DROP COLUMN `views`;
ALTER TABLE published_articles DROP COLUMN `public_article_id`;
ALTER TABLE published_articles ADD published_article_id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY;