Upgrade Deadlock 3.1.1-4 to 3.3.0-23: Duplicate column name 'email_id' / Table 'users_tmp' already exists

Describe the issue or problem

What happens:
I am trying to upgrade our institutional OJS database on a Linux shared hosting server, but the migration tool is completely deadlocked. The live website currently shows a blank screen or a “500 Internal Server Error” on all individual journal pathways (e.g., /bij, /kaib1, /jsms). The cPanel error_log indicates a fatal crash because modern tables like navigation_menu_items or publications are completely missing.

When running the official command-line upgrade utility (php tools/upgrade.php upgrade), the process halts immediately. First, it crashes with:
ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users_tmp' already exists

If we manually drop or rename users_tmp, authors_tmp, and temp_authors to clear this hurdle, the very next execution crashes face-first into a duplicate schema element:
ERROR: Upgrade failed: DB: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'email_id' (SQL: ALTER TABLE email_templates_data ADD email_id BIGINT)

The database appears to be trapped in an un-upgradable, hybrid schema state due to a previous automated script failure. It is mathematically impossible for the automated script to pass both queries sequentially on its own.

What I expected to happen:
I expected the upgrade script to parse the older database framework sequentially, ignore or step over existing structural elements, and successfully complete the data migration forward to version 3.3.0-23.


:hammer_and_wrench: Steps I took leading up to the issue

  1. An automated installer tool (Softaculous) forced an upgrade loop that failed and aborted halfway.
  2. The hosting provider successfully restored our pristine core application backup and file repository (ojsdata) from 1 October 2026. The database structure belongs to OJS 3.1.1-4.
  3. The server core files in /public_html/journal were prepared for version 3.3.0-23.
  4. Set the parameters inside config.inc.php to installed = Off.
  5. Opened the cPanel Terminal app and logged into the journal root directory.
  6. Executed the upgrade command using the stable environment path: /opt/cpanel/ea-php74/root/usr/bin/php tools/upgrade.php upgrade
  7. The process aborts instantly, throwing the users_tmp already exists error.
  8. Dropped the temporary tables and re-ran the upgrade tool, resulting in the Duplicate column name 'email_id' crash loop.

:mobile_phone: What application are you using?

  • Application Framework: Open Journal Systems (OJS)
  • Source Database Layout: Version 3.1.1-4 (Reverted to stable October 1st backup)
  • Target Application Tree: Version 3.3.0-23
  • Server Environment: Linux Shared Hosting, LiteSpeed/Apache, PHP 7.4.33, MySQL (Tables converted to InnoDB)

Additional information

Full Server Terminal Output Logs:

text

[borneojo@india8 journal]$ /opt/cpanel/ea-php74/root/usr/bin/php tools/upgrade.php upgrade
2026-10-14 01:34:38 [pre-install]
2026-10-14 01:34:38 [load: upgrade.xml]
2026-10-14 01:34:38 [version: 3.3.0.23]
2026-10-14 01:34:38 [code: Installer Installer::checkPhpVersion]
2026-10-14 01:34:39 [data: dbscripts/xml/upgrade/3.1.2_preupdate_user_author_names.xml]
ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users_tmp' already exists (SQL: CREATE TABLE users_tmp AS (SELECT user_id, first_name, last_name, middle_name, salutation, suffix FROM users))

[borneojo@india8 journal]$ /opt/cpanel/ea-php74/root/usr/bin/php tools/upgrade.php upgrade
2026-10-14 01:36:39 [pre-install]
2026-10-14 01:36:39 [load: upgrade.xml]
2026-10-14 01:36:39 [version: 3.3.0.23]
2026-10-14 01:36:39 [code: Installer Installer::checkPhpVersion]
2026-10-14 01:36:40 [data: dbscripts/xml/upgrade/3.1.2_preupdate_user_author_names.xml]
2026-10-14 01:36:40 [data: dbscripts/xml/upgrade/3.2.0_preupdate_email_templates.xml]
ERROR: Upgrade failed: DB: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'email_id' (SQL: ALTER TABLE email_templates_data ADD email_id BIGINT)

PHP Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘borneojo_ojs19.navigation_menu_items’ doesn’t exist in /home/borneojo/public_html/journal/lib/pkp/lib/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:80
Stack trace:
#0 PDO->prepare(‘SELECT * FROM n…’, Array)
#1 Illuminate\Database\Connection->Illuminate\Database{closure}(Object(Illuminate\Database\Query\Expression), Array)

Our primary 3.1.1-4 database records, published articles, and uploaded PDF text volumes remain completely safe and archived. We need advice on what schema correction queries, table version row updates, or core script patches can be applied to completely break this schema mismatch cycle so the platform can finalize its data structures cleanly to OJS 3.3.


Please continue in the original post : Database Schema Error: Unknown column 'et.email_id' in SELECT during upgrade from 3.1.1-4 to 3.3.0-23 - #2 by grierb

Closing this as an extension of the original issue.