Upgrade from OJS 3.3.0.22 to 3.5.0.3 fails: Table 'dois' already exists (SQLSTATE[42S01])

Describe the issue or problem
Hi everyone,

I’m trying to upgrade OJS from version 3.3.0.17 to 3.5.0.3 and I’m consistently hitting the following error:

ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘dois’ already exists (SQL: create table dois (doi_id bigint not null auto_increment primary key, context_id bigint not null, doi varchar(255) not null, status smallint not null default ‘1’) default character set utf8 collate ‘utf8_general_ci’)

The table dois (along with doi_settings, files, jobs, institutions, institution_settings, institution_ip, sessions) already exists in my 3.3.0.22 database. These tables are not empty — for example, dois contains 153 records with real DOI data.

My setup:

  • Starting version: OJS 3.3.0.17 (upgraded to 3.3.0.22 successfully before attempting 3.4/3.5)
  • Target version: OJS 3.5.0.3 (also tried 3.4.0-10)
  • PHP: 8.2
  • MySQL: InnoDB, utf8mb3_general_ci (all tables consistent)
  • Server: Linux/Apache

From the upgrade log I can see that the migration I7014_DoiMigration is the one failing, as it tries to CREATE the dois table without checking whether it already exists.

Thanks in advance!

What application are you using?
OJS 3.3.0.17

Same Issue.

The specific errors I am rotating between are:

  1. Missing Column in site Table: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'redirect' in 'site' (SQL: alter table site modify redirect bigint null)

  2. Duplicate Column in site Table: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'redirect_context_id' (SQL: alter table site rename column redirect to redirect_context_id)

  3. Missing Column in notification_subscription_settings: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'context' in 'notification_subscription_settings' (SQL: alter table notification_subscription_settings rename column context to context_id)

Hi @paolo_pellegrino,

After an upgrade attempt fails, you’ll need to restore your database from backup before trying again. Make sure not just to reload your database dump, as the failed upgrade attempt may have created additional tables (like dois); make sure to drop and re-create the database entirely. (And make sure your backup is good!)

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you, it worked.

Best regards and good work.

Paolo Pellegrino

1 Like

This topic was automatically closed after 13 days. New replies are no longer allowed.