Error upgrading from 3.4.0.4 to 3.5.0.0

Describe the issue or problem
When upgrading a 3.4.0.4 database to 3.5.0.0, I’m getting errors about a table invitations that already exists.

Steps I took leading up to the issue

  1. executing php tools/upgrade.php check returns following output:
    Code version:      3.5.0.0
    Database version:  3.4.0.4
    Latest version:    3.5.0.0
    Database version is older than code version
    Run "tools/upgrade.php upgrade" to update
    
  2. executing php tools/upgrade.php upgrade fails with following error:
    2025-07-02 15:50:28 [pre-install]
    2025-07-02 15:50:28 [load: upgrade.xml]
    2025-07-02 15:50:28 [version: 3.5.0.0]
    2025-07-02 15:50:28 [code: Installer Installer::checkPhpVersion]
    2025-07-02 15:50:28 [code: Installer Installer::installDefaultNavigationMenus]
    [02-Jul-2025 15:50:28 UTC] WARNING: The NavigationMenu (ContextId: 1, Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
    [02-Jul-2025 15:50:28 UTC] WARNING: The NavigationMenu (ContextId: 1, Title: Primary Navigation Menu, Area: primary) will be skipped because the specified area has already a NavigationMenu attached.
    [02-Jul-2025 15:50:28 UTC] WARNING: The NavigationMenu (ContextId: , Title: User Navigation Menu, Area: user) will be skipped because the specified area has already a NavigationMenu attached.
    2025-07-02 15:50:28 [code: Installer Installer::migrateStaticPagesToNavigationMenuItems]
    2025-07-02 15:50:28 [migration: PKP\migration\upgrade\v3_4_0\I10249_FixProfileImageDataLoss]
    2025-07-02 15:50:28 [migration: PKP\migration\upgrade\v3_4_0\I9627_AddUsageStatsTemporaryTablesIndexes]
    2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_4_0\I9535_FixEmptyFileStage]
    2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_4_0\I9830_FixEmptyUserLocales]
    2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_4_0\I8592_SiteNotificationSubscriptions]
    2025-07-02 15:50:29 [migration: APP\migration\upgrade\v3_4_0\I9813_QuickSubmitSubmissionProgressType]
    2025-07-02 15:50:29 [migration: APP\migration\upgrade\v3_5_0\I11241_MissingDecisionConstantsUpdate]
    2025-07-02 15:50:29 [migration: PKP\migration\upgrade\v3_5_0\PreflightCheckMigration]
    2025-07-02 15:50:29 [migration: APP\migration\upgrade\v3_5_0\I8333_AddMissingForeignKeys]
    2025-07-02 15:50:33 [migration: APP\migration\upgrade\v3_5_0\I9892_FloatToDecimalColumnTypeUpdate]
    2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\I9895_AddAppKeyToConfigFile]
    2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\I9678_RemoveScheduledTasksTable]
    2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\InstallEmailTemplates]
    2025-07-02 15:50:33 [migration: PKP\migration\upgrade\v3_5_0\I9197_MigrateAccessKeys]
    2025-07-02 15:50:33 [revert migration: PKP\migration\upgrade\v3_5_0\InstallEmailTemplates]
    2025-07-02 15:50:33 [revert migration: PKP\migration\upgrade\v3_5_0\I9678_RemoveScheduledTasksTable]
    2025-07-02 15:50:33 [revert migration: PKP\migration\upgrade\v3_5_0\I9895_AddAppKeyToConfigFile]
    2025-07-02 15:50:33 [revert migration: APP\migration\upgrade\v3_5_0\I9892_FloatToDecimalColumnTypeUpdate]
    2025-07-02 15:50:33 [revert migration: APP\migration\upgrade\v3_5_0\I8333_AddMissingForeignKeys]
    2025-07-02 15:50:33 [downgrade for "APP\migration\upgrade\v3_5_0\I8333_AddMissingForeignKeys" unsupported: Downgrade not supported]
    ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'invitations' already exists (Connection: mysql, SQL: create table `invitations` (`invitation_id` bigint not null auto_increment primary key, `key_hash` varchar(255) null, `type` varchar(255) not null, `user_id` bigint null, `inviter_id` bigint null, `expiry_date` datetime null, `payload` json null, `status` enum('INITIALIZED', 'PENDING', 'ACCEPTED', 'DECLINED', 'CANCELLED') not null, `email` varchar(255) null comment 'When present, the email address of the invitation recipient; when null, user_id must be set and the email can be fetched from the users table.', `context_id` bigint null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
    

What application are you using?
OJS 3.5.0.0

Hi @rvdb,

The error message is saying that the upgrade is trying to create an invitations table in your database, but one already exists.

If you encounter an upgrade failure, make sure to restore your database to its 3.4.0-x state from backup before trying again. And don’t just reload the SQL dump – make sure to drop and re-create the database. Otherwise you might end up with extra tables, and errors like this.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher ,

Duh, thanks for pointing that out, it’s probably been a long time since last time. I had clearly overlooked the drop database part, and assumed a fresh import would overwrite the existing db.

This fixed my issue, after which I bumped on 3.4.0.9 to 3.5.0.0 SQL Syntax Error During OJS Upgrade – `email_templates_default_data` Table (MariaDB).

I have tried with your patch from pkp/pkp-lib#11529 Fix MariaDB upgrade error due to MDEV-13132 · pkp/pkp-lib@d6b71bb · GitHub and can confirm that works as well, I have a shiny OJS-3.5.0 version up and running now!

Best,

Ron

1 Like

Hi @rvdb,

Great! Glad to hear it’s working.

Thanks,
Alec Smecher
Public Knowledge Project Team

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