Upgrading to 3.4.0+

Describe the issue or problem
I am helping some folks upgrade from 3.3.something to 3.4.0-7

Steps I took leading up to the issue

  1. after some issues, I first upgraded to ojs-3.3.0-19 → got this working fine
  2. tried 3.4.0-0 but saw it had issues, so tried 3.4.0-1 but the issues persist:
    a) dealt with the unprocessed logs
    b) dealt with the InnoDB issues
  3. big issues:
  • 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’)
  • dropped the dois table because it was empty
  • ERROR: Upgrade failed: DB: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘at.assoc_type’ in ‘where clause’ (SQL: select distinct at.type_id from announcement_types as at left join journals as c on at.assoc_id = c.journal_id where c.journal_id is null or at.assoc_type <> 256)
  • I can resolve this by adding:
    • ALTER TABLE announcement_types ADD COLUMN assoc_type INT DEFAULT NULL;
    • ALTER TABLE announcement_types ADD COLUMN assoc_id BIGINT DEFAULT NULL;
  • but then we get all kinds of errors about duplicate keys or other issues - I was very persistent and did all of the following

ALTER TABLE journals DROP FOREIGN KEY journals_current_issue_id_foreign;
ALTER TABLE journals DROP COLUMN current_issue_id;
ALTER TABLE journals DROP INDEX journals_current_issue_id;
ALTER TABLE issues ADD COLUMN current TINYINT(1) DEFAULT 0;

DELETE FROM scheduled_tasks
WHERE class_name = ‘APP\plugins\importexport\doaj\DOAJInfoSender’
LIMIT 1;

DELETE FROM scheduled_tasks
WHERE class_name = ‘lib.pkp.classes.task.ReviewReminder’;

DELETE FROM scheduled_tasks
WHERE class_name = ‘lib.pkp.classes.task.StatisticsReport’;

CREATE TABLE review_form_responses_backup AS SELECT * FROM review_form_responses;
ALTER TABLE review_form_responses DROP FOREIGN KEY review_form_responses_review_form_element_id_foreign;
ALTER TABLE review_form_responses DROP FOREIGN KEY review_form_responses_review_id_foreign;
ALTER TABLE review_form_responses DROP INDEX review_form_responses_unique;
ALTER TABLE review_round_files DROP INDEX review_round_files_unique;
ALTER TABLE review_files DROP INDEX review_files_unique;
ALTER TABLE scheduled_tasks DROP INDEX scheduled_tasks_unique;
ALTER TABLE announcement_type_settings DROP INDEX announcement_type_settings_unique;
ALTER TABLE announcement_settings DROP INDEX announcement_settings_unique;
ALTER TABLE category_settings DROP FOREIGN KEY category_settings_category_id_foreign;
ALTER TABLE category_settings DROP INDEX category_settings_unique;
ALTER TABLE versions DROP INDEX versions_unique;
ALTER TABLE site_settings DROP INDEX site_settings_unique;
ALTER TABLE user_settings DROP INDEX user_settings_unique;
ALTER TABLE notification_settings DROP INDEX notification_settings_unique;
ALTER TABLE email_templates_default_data DROP INDEX email_templates_default_data_unique;
ALTER TABLE email_templates_settings DROP INDEX email_templates_settings_unique;
ALTER TABLE oai_resumption_tokens DROP INDEX oai_resumption_tokens_unique;
ALTER TABLE plugin_settings DROP INDEX plugin_settings_unique;
ALTER TABLE genre_settings DROP INDEX genre_settings_unique;
ALTER TABLE library_file_settings DROP INDEX library_file_settings_unique;
ALTER TABLE event_log_settings DROP INDEX event_log_settings_unique;
ALTER TABLE citation_settings DROP INDEX citation_settings_unique;
ALTER TABLE filter_settings DROP INDEX filter_settings_unique;
ALTER TABLE navigation_menu_item_settings DROP INDEX navigation_menu_item_settings_unique;
ALTER TABLE navigation_menu_item_assignment_settings DROP INDEX navigation_menu_item_assignment_settings_unique;
ALTER TABLE review_form_settings DROP INDEX review_form_settings_unique;
ALTER TABLE review_form_element_settings DROP INDEX review_form_element_settings_unique;
ALTER TABLE user_group_settings DROP INDEX user_group_settings_unique;
ALTER TABLE user_user_groups DROP INDEX user_user_groups_unique;
ALTER TABLE user_group_stage DROP INDEX user_group_stage_unique;
ALTER TABLE submission_file_settings DROP INDEX submission_file_settings_unique;
ALTER TABLE submission_settings DROP INDEX submission_settings_unique;
ALTER TABLE publication_settings DROP INDEX publication_settings_unique;
ALTER TABLE author_settings DROP INDEX author_settings_unique;
ALTER TABLE subeditor_submission_group DROP INDEX section_editors_unique;
ALTER TABLE query_participants DROP INDEX query_participants_unique;
ALTER TABLE submission_search_object_keywords DROP FOREIGN KEY submission_search_object_keywords_keyword_id;
ALTER TABLE submission_search_object_keywords DROP FOREIGN KEY submission_search_object_keywords_object_id_foreign;
ALTER TABLE submission_search_object_keywords DROP INDEX submission_search_object_keywords_unique;
ALTER TABLE data_object_tombstone_settings DROP INDEX data_object_tombstone_settings_unique;
ALTER TABLE journal_settings DROP INDEX journal_settings_unique;
ALTER TABLE section_settings DROP INDEX section_settings_unique;
ALTER TABLE issue_settings DROP INDEX issue_settings_unique;
ALTER TABLE issue_galley_settings DROP INDEX issue_galley_settings_unique;
ALTER TABLE custom_issue_orders DROP INDEX custom_issue_orders_unique;
ALTER TABLE custom_section_orders DROP INDEX custom_section_orders_unique;
ALTER TABLE publication_galley_settings DROP INDEX publication_galley_settings_unique;
ALTER TABLE subscription_type_settings DROP INDEX subscription_type_settings_unique;

  • this finally runs up to here:

2024-12-21 03:50:00 [pre-install]
2024-12-21 03:50:00 [load: upgrade.xml]
2024-12-21 03:50:00 [version: 3.4.0.1]
2024-12-21 03:50:00 [code: Installer Installer::checkPhpVersion]
2024-12-21 03:50:00 [code: Installer Installer::installDefaultNavigationMenus]
2024-12-21 03:50:00 [code: Installer Installer::migrateStaticPagesToNavigationMenuItems]
2024-12-21 03:50:00 [migration: APP\migration\upgrade\v3_4_0\PreflightCheckMigration]
2024-12-21 03:50:01 [migration: PKP\migration\upgrade\v3_4_0\I8060_UpdateUserLocalesDefaultToEmptyArrayFromNull]
2024-12-21 03:50:01 [migration: PKP\migration\upgrade\v3_4_0\I7245_UpdateUserLocaleStringToParsableJsonString]
2024-12-21 03:50:01 [migration: APP\migration\upgrade\v3_4_0\I7129_IssueEntityDAORefactor]
2024-12-21 03:50:01 [migration: APP\migration\upgrade\v3_4_0\I6091_AddFilterNamespaces]
2024-12-21 03:50:01 [migration: APP\migration\upgrade\v3_4_0\I3573_AddPrimaryKeys]
2024-12-21 03:50:02 [migration: APP\migration\upgrade\v3_4_0\I6093_AddForeignKeys]
2024-12-21 03:50:02 [revert migration: APP\migration\upgrade\v3_4_0\I3573_AddPrimaryKeys]
2024-12-21 03:50:23 [revert migration: APP\migration\upgrade\v3_4_0\I6091_AddFilterNamespaces]
2024-12-21 03:50:23 [revert migration: APP\migration\upgrade\v3_4_0\I7129_IssueEntityDAORefactor]
2024-12-21 03:50:23 [revert migration: PKP\migration\upgrade\v3_4_0\I7245_UpdateUserLocaleStringToParsableJsonString]
2024-12-21 03:50:23 [downgrade for “PKP\migration\upgrade\v3_4_0\I7245_UpdateUserLocaleStringToParsableJsonString” unsupported: Downgrade not supported]
ERROR: Upgrade failed: DB: SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP ‘announcement_types_assoc’; check that column/key exists (SQL: alter table announcement_types drop index announcement_types_assoc)

  • so i tried adding it: ALTER TABLE announcement_types ADD INDEX announcement_types_assoc (assoc_id);
  • which then cycles me back to the beginning
    ERROR: Upgrade failed: DB: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘context_id’ (SQL: ALTER TABLE announcement_types CHANGE assoc_id context_id BIGINT DEFAULT NULL)

So, any ideas what to try next?

I checked some of the other issues/comments here but couldn’t quite figure it out :expressionless: we don’t have things with missing dois (which was the closest one I saw).

Hi @doomlab,

When upgrading from 3.3.0-x to 3.4.0-x, it’s best to use the latest 3.4.0-x release.

Are you restoring your 3.3.0-x database from backup before re-running an upgrade process? If so, make sure you’re actually dropping the database and re-creating an empty one before reloading from the database dump, or else extra tables like dois will be left in place and conflict with the upgrade process.

Regards,
Alec Smecher
Public Knowledge Project Team

Thanks for the response! Happy holidays :slight_smile:

The short answer to your question is yes - but the upgrade still fails. I did an investigation and took notes here: OJS 3.4 Upgrade · GitHub

I still got an error for the announcement_types table - even after I dropped it before starting since it was empty. Can you check this out and see if you see what the issue is?