Error During Upgrade to OJS

Dear @Vitaliy

I made a clean git install from stable-3_3_0 branch on an xcloud server.
Then I copied all the tables from the journal database to testing database.
Then, I copied contents of public folder and files folder to new testing domain. After configuring, I tried upgrade via command line.

  • Current (Database) Version - e.g., OJS
    Operating system | CentOS Linux 7.9.2009
    Perl version | 5.016003
    Apache version | 2.4.6
    PHP versions 7.4.14
    MariaDB version | 10.4.17
    php runs as cgi-wrapper

But before starting the upgrade, I applied the query on Submission files upgrade step is slow · Issue #6474 · pkp/pkp-lib · GitHub page and get similar results

SELECT DISTINCT rf.file_id FROM review_files rf LEFT JOIN submission_files sf ON (rf.file_id = sf.file_id) WHERE sf.file_id IS NULL;


Then I removed these rows by;

DELETE FROM review_files WHERE file_id IN (9581, 9582, 9583, 9584, 9585);

When I run the upgrade, I get an SQL error;

[migration: PKPv3_3_0UpgradeMigration]

ERROR: Upgrade failed: DB: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (upgrade.#sql-468_2026, CONSTRAINT review_files_submission_file_id_foreign FOREIGN KEY (submission_file_id) REFERENCES submission_files (submission_file_id)) (SQL: alter table review_files add constraint review_files_submission_file_id_foreign foreign key (submission_file_id) references submission_files (submission_file_id))

I try to understand whether the issue is specific to my database, or some other people has experienced the same error eventhough after applying the SQL command above. But I still get the same error during upgrade via command line.

Although not urgent, I am looking for a solution as I am considering to upgrade soon.
I may share account information if needed.


Hi @drugurkocak,

I’m unable to reproduce it. If deliberately corrupt the data in the way that review_files.file_id points to the submission_files.file_id that is missing, this part of migration scipt: pkp-lib/ at a369bc4ad2f4241e3e0dfb002aae3f6857ba5397 · pkp/pkp-lib · GitHub handles such cases and I on testing I receive a message:

Removing orphaned review_files entry with review_id ID 149 and submission_file_id 2160
Removing orphaned review_files entry with review_id ID 150 and submission_file_id 2160

Can you check that file_id column in those tables has the same type (bigint(20))?

Dear @Vitaliy
Thank you for your kind reply.
The file_id column in review_files and submission_files are both type bigint(20).


Can you export review_files and submission_files table and send them to me (privately)?

I’ve brought it to attention here: Review files pointing to non-existing submission file may break upgrade to 3.3 · Issue #6743 · pkp/pkp-lib · GitHub

Can you check if this commit solves the issue?

Dear @Vitaliy
Thank you for your valuable support.

I made a new install from origin/stable_3_3_0 branch and applied 2 patches.

  1. Unable to upgrade Call to a member function getConnection() on null · Issue #6703 · pkp/pkp-lib · GitHub
  2. pkp/pkp-lib#6743 Remove non-existing submission file id in review_files by Vitaliy-1 · Pull Request #6745 · pkp/pkp-lib · GitHub

Now, the upgrade was successfuly completed without any error message. The php-error.log contains only “Removing orphaned submission_files entry ID” messages.
Thank you very much.