Problem in upgrading OJS 3 into OJS 3.0.1

I can not upgrade OJS 3 into OJS 3.0.1…The following error message appear to me:

A database error has occurred: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry ‘906’ for key ‘PRIMARY’

Hi @Abd_El-Nasser_Gharee,

Hmm, I’ve never seen that message before – could you try restoring your database from backup to its 3.0.0 level, then turning on the debug setting in config.inc.php, then running the upgrade again? This will dump all SQL statements out, and the last one will be the statement that resulted in the error message.

Regards,
Alec Smecher
Public Knowledge Project Team

Dear @asmecher

In fact I didn’t make a backup from my database but I turned on the debug and tried again to upgrade the last line was:

1062: ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '906' for key 'PRIMARY'
                                ADOConnection._Execute(ALTER TABLE library_files DROP COLUMN `revision`, false) % line 1051, file: adodb.inc.php
                             ADOConnection.Execute(ALTER TABLE library_files DROP COLUMN `revision`) % line  440, file: Installer.inc.php
                          Installer.executeSQL(ALTER TABLE library_files DROP COLUMN `revision`) % line  435, file: Installer.inc.php
                       Installer.executeSQL(Array[28]) % line  375, file: Installer.inc.php
                    Installer.executeAction(Array[3]) % line  265, file: Installer.inc.php

Hi @Abd_El-Nasser_Gharee,

Hmm, can you describe your upgrade history in a little more detail? The revision column of the library_files table is not present in either OJS 3.0.0 or OJS 3.0.1, so I’m not sure why it’s in your database.

If an upgrade fails, your database will be left in a state somewhere between the old version and the new version. Depending on how big a gap the upgrade is, and depending on where it failed, it can be very difficult to return it to a consistent state. That’s why it’s always a good idea to create a backup of your system before upgrading.

Regards,
Alec Smecher
Public Knowledge Project Team

Dear @asmecher

below the upgrading history:

Hi @Abd_El-Nasser_Gharee,

Do you have any idea why there might be a revision column in the library_files table? As far as I’m aware, that column has never existed in any of our releases. Have you modified your database or something?

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

No I don’t have any idea … I don’t remember that i modified it…Can I delete this column by PhpAdmin?

Regards

Hi @Abd_El-Nasser_Gharee,

Yes, try dropping that column in phpMyAdmin – but please take a backup before doing so!

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

There are three tables “library_files”, “library_files2” and “library_files_settings” …which one i should delete column “revision”?

Hi @Abd_El-Nasser_Gharee,

The library_files table is the one that the error message above relates to. The library_files2 table is also something that’s not from our software – I have no idea why it’s there. Don’t worry about library_files_settings for now.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I tried to delete this column but i have error message from mysql:

mysql says:
#1062 - ALTER TABLE causes auto_increment resequencing, resulting in duplicate entry '906' for key 'PRIMARY'

Hi @Abd_El-Nasser_Gharee,

What do the contents of the library_files table look like? Can you post a few example rows here?

Regards,
Alec Smecher
Public Knowledge Project Team

This is the table structure:

Hi @Abd_El-Nasser_Gharee,

That is not the right structure for the library_files table – it looks like someone has made a copy of the article_files table. It’s hard for me to give advice without knowing what has been done in this database, but I would suggest deleting the table entirely and letting the installer/upgrade tool create it properly.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher

I deleted the library_files table and created another one by upgrading …The old error message disappeared but another error appear to me related to googlescholar plugin. Here is the messege:

Errors occurred during installation:

A database error has occurred: Duplicate entry 'googlescholarplugin-2-enabled' for key 'plugin_settings_pkey'

Hi @Abd_El-Nasser_Gharee,

This is probably caused by attempts to run the upgrade script on a database that was already partially upgraded, and I won’t be able to provide much support for this if it gets complicated. However, this will be resolved if you apply this change.

Regards,
Alec Smecher
Public Knowledge Project Team

Dear @asmecher

I applied the last change and the upgrade process completed successfully. Thanks.

Regards