Migration issue from OJS 3.3 to 3.4

Since this thread is closed. I am starting a new one.

Hi, @asmecher ,

I was able to create a “master cleanup script” in SQL with the help of AI. After each failed upgrade attempt, I added the fix for the new error to this script. I would then restore the original database and run the full cleanup script before trying the upgrade again.

But I am stuck in this error.
ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘metrics_counter_submission_institution_daily’ already exists (SQL: create table metrics_counter_submission_institution_daily (metrics_counter_submission_institution_daily_id bigint unsigned not null auto_increment primary key, load_id varchar(255) not null, context_id bigint not null, submission_id bigint not null, institution_id bigint not null, date date not null, metric_investigations int not null, metric_investigations_unique int not null, metric_requests int not null, metric_requests_unique int not null) default character set utf8 collate ‘utf8_general_ci’)

I added the full log and sql script in the below link
https://filebin.net/sj8mxb11301lin00

can you check and give a way forward?

Hi @Mouhamed_Noordeen,

It looks to me like your workflow is…

  1. Run the upgrade script
  2. Examine the error message
  3. Adjust your SQL script to try a correction
  4. Back to step 1

However, your workflow should be…

  1. Restore to the earliest possible backup you have
  2. Run the upgrade script
  3. Examine the error message
  4. Adjust your SQL script to add a correction
  5. Back to step 1

Otherwise you’ll be chasing your own tail trying to adjust your script (step 4) to undo work that the upgrade script is doing (step 2). Plus you’ll be accumulating errors based on any mistakes you make in your own SQL script.

Regards,
Alec Smecher
Public Knowledge Project Team

However, your workflow should be…

Restore to the earliest possible backup you have
Run the upgrade script
Examine the error message
Adjust your SQL script to add a correction
Back to step 1

The workflow you describe what exactly I was doing.
I am stuck with error.

2025-06-26 09:05:41 [revert migration: PKP\migration\upgrade\v3_4_0\I6782_UsageStatsSettings]
2025-06-26 09:05:41 [downgrade for “PKP\migration\upgrade\v3_4_0\I6782_UsageStatsSettings” unsupported: Downgrade not supported]
ERROR: Upgrade failed: DB: SQLSTATE[42S01]: Base table or view already exists: 1050 Table ‘metrics_counter_submission_institution_daily’ already exists (SQL: create table metrics_counter_submission_institution_daily (metrics_counter_submission_institution_daily_id bigint unsigned not null auto_increment primary key, load_id varchar(255) not null, context_id bigint not null, submission_id bigint not null, institution_id bigint not null, date date not null, metric_investigations int not null, metric_investigations_unique int not null, metric_requests int not null, metric_requests_unique int not null) default character set utf8 collate ‘utf8_general_ci’)

I added my updated script and logs here
https://filebin.net/sj8mxb11301lin00