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’)
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
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’)