Upgrade from 2.4.6 to 3.1.2-1 Column 'review_round_id' cannot be null

My System: apache2 php7 and mysql5.
I read post Error Upgrade 2.4.8.2 to 3.1.0 and i can’t fix “ERROR: Upgrade failed: DB: Column ‘review_round_id’ cannot be null” error.

PHP Notice:  Deprecated call without request object. in 
/app/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 872
Notice: Deprecated call without request object. in 
/app/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 872
PHP Warning:  ini_set(): Headers already sent. You cannot change the session 
module's ini settings at this time in 
/app/lib/pkp/classes/session/SessionManager.inc.php on line 35
Warning: ini_set(): Headers already sent. You cannot change the session module's 
ini settings at this time in /app/lib/pkp/classes/session/SessionManager.inc.php on 
line 35
PHP Warning:  ini_set(): Headers already sent. You cannot change the session 
module's ini settings at this time in 
/app/lib/pkp/classes/session/SessionManager.inc.php on line 36
Warning: ini_set(): Headers already sent. You cannot change the session module's 
ini settings at this time in /app/lib/pkp/classes/session/SessionManager.inc.php on 
line 36
PHP Warning:  ini_set(): Headers already sent. You cannot change the session 
module's ini settings at this time in 
/app/lib/pkp/classes/session/SessionManager.inc.php on line 37

Warning: ini_set(): Headers already sent. You cannot change the session module's 
ini settings at this time in /app/lib/pkp/classes/session/SessionManager.inc.php on 
line 37
PHP Warning:  ini_set(): Headers already sent. You cannot change the session 
module's ini settings at this time in 
/app/lib/pkp/classes/session/SessionManager.inc.php on line 38
Warning: ini_set(): Headers already sent. You cannot change the session module's 
ini settings at this time in /app/lib/pkp/classes/session/SessionManager.inc.php on 
line 38
PHP Warning:  ini_set(): Headers already sent. You cannot change the session 
module's ini settings at this time in 
/app/lib/pkp/classes/session/SessionManager.inc.php on line 39
Warning: ini_set(): Headers already sent. You cannot change the session module's 
ini settings at this time in /app/lib/pkp/classes/session/SessionManager.inc.php on 
line 39
PHP Warning:  ini_set(): Headers already sent. You cannot change the session 
module's ini settings at this time in 
/app/lib/pkp/classes/session/SessionManager.inc.php on line 40
Warning: ini_set(): Headers already sent. You cannot change the session module's 
ini settings at this time in /app/lib/pkp/classes/session/SessionManager.inc.php on 
line 40
PHP Notice:  Deprecated call without request object. in 
/app/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 872
Notice: Deprecated call without request object. in 
/app/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 872
PHP Notice:  Deprecated call without request object. in 
/app/lib/pkp/classes/template/PKPTemplateManager.inc.php on line 872

[pre-install]
[load: upgrade.xml]
[version: 3.1.2.1]
[code: Installer Installer::checkPhpVersion]
[code: Installer Installer::syncSeriesAssocType]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics2.xml (skipped)]
[code: Installer Installer::removeReviewEntries]
[data: dbscripts/xml/upgrade/3.0.0_preupdate.xml]

PHP Notice:  Only variables should be assigned by reference in 
/app/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
[data: dbscripts/xml/upgrade/3.0.0_adaptTimedViews.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_adaptReferrals.xml]
PHP Notice:  Only variables should be assigned by reference in 
/app/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122

[data: dbscripts/xml/upgrade/remove_timed_views_bots.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_preupdate_commentsToEditor.xml]
[data: dbscripts/xml/upgrade/3.1.0_preupdate_review_assignments.xml]
[data: dbscripts/xml/upgrade/3.1.0_preupdate_notes.xml]
[data: dbscripts/xml/upgrade/3.1.0_preupdate_payments.xml]
PHP Notice:  Only variables should be assigned by reference in 
/app/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
Notice: Only variables should be assigned by reference in 
/app/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122
[data: dbscripts/xml/upgrade/3.1.1_preupdate_citations.xml]
PHP Notice:  Only variables should be assigned by reference in 
/app/lib/pkp/classes/db/DBDataXMLParser.inc.php on line 122

[data: dbscripts/xml/upgrade/3.1.2_preupdate_user_author_names.xml]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/log.xml]
[schema: lib/pkp/xml/schema/announcements.xml]
[schema: lib/pkp/xml/schema/scheduledTasks.xml]
[schema: lib/pkp/xml/schema/temporaryFiles.xml]
[schema: lib/pkp/xml/schema/metadata.xml]
[schema: lib/pkp/xml/schema/reviews.xml]
[schema: lib/pkp/xml/schema/reviewForms.xml]
[schema: lib/pkp/xml/schema/controlledVocab.xml]
[schema: lib/pkp/xml/schema/submissions.xml]
[schema: lib/pkp/xml/schema/submissionFiles.xml]
[schema: lib/pkp/xml/schema/categories.xml]
[schema: lib/pkp/xml/schema/notes.xml]
[schema: lib/pkp/xml/schema/genres.xml]
[schema: lib/pkp/xml/schema/tombstone.xml]
[schema: lib/pkp/xml/schema/rolesAndUserGroups.xml]
[schema: lib/pkp/xml/schema/metrics.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/libraryFiles.xml]
[schema: lib/pkp/xml/schema/navigationMenus.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]
[code: Installer Installer::installDefaultNavigationMenus]
[code: Installer Installer::migrateStaticPagesToNavigationMenuItems]
[code: Installer Installer::migrateSRLocale]
[code: Installer Installer::migrateUserAndAuthorNames]
[code: Installer Installer::concatenateIntoAbout]
[code: Installer Installer::concatenateIntoMasthead]
[code: Installer Installer::migrateCounterPluginUsageStatistics (skipped)]
[code: Installer Installer::migrateTimedViewsUsageStatistics (skipped)]
[code: Installer Installer::migrateDefaultUsageStatistics (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postUsageStatsMigration2.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postCounterMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_postTimedViewsMigration.xml (skipped)]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type.xml]
[data: dbscripts/xml/upgrade/3.0.0_change_assoc_type_metrics.xml]
[data: dbscripts/xml/upgrade/3.0.0_settings.xml]
[code: Installer Installer::installDefaultGenres]
[code: Installer Installer::migrateArticleMetadata]

PHP Warning:  Declaration of 
SubmissionLanguageEntryDAO::getByControlledVocabId($controlledVocabId, 
$rangeInfo = NULL) should be compatible with 
ControlledVocabEntryDAO::getByControlledVocabId($controlledVocabId, 
$rangeInfo = NULL, $filter = NULL) in 
/app/lib/pkp/classes/submission/SubmissionLanguageEntryDAO.inc.php on line 20
Warning: Declaration of 
SubmissionKeywordEntryDAO::getByControlledVocabId($controlledVocabId, 
$rangeInfo = NULL) should be compatible with 
ControlledVocabEntryDAO::getByControlledVocab
Id($controlledVocabId, $rangeInfo = NULL, $filter = NULL) in 
/app/lib/pkp/classes/submission/SubmissionKeywordEntryDAO.inc.php on line 45

[data: dbscripts/xml/upgrade/3.0.0_update.xml]
[code: Installer Installer::clearDataCache]
[code: Installer Installer::migrateUserRoles]
[code: Installer Installer::fixReviewForms]
[code: Installer Installer::htmlifyEmailTemplates]
[note: docs/release-notes/README-BEACON]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[code: Installer Installer::installEmailTemplate]
[data: dbscripts/xml/upgrade/3.0.0_scheduledTasks.xml]
[code: Installer Installer::localizeCustomBlockSettings]
[code: Installer Installer::convertEditorDecisionNotes]
[code: Installer Installer::convertQueries]
[code: Installer Installer::migrateFiles]
[code: Installer Installer::convertSupplementaryFiles]
[code: Installer Installer::provideSupplementaryFilesForReview]
[code: Installer Installer::setFileUploader]
[code: Installer Installer::setFileName]
[data: dbscripts/xml/upgrade/3.0.0_postupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_pubId_settings.xml]
[data: dbscripts/xml/upgrade/3.0.0_postupgrade_galley_files.xml]
[data: dbscripts/xml/upgrade/3.0.0_postupgrade_metrics.xml]
[data: dbscripts/xml/upgrade/3.0.0_issue_settings.xml]
[data: dbscripts/xml/upgrade/3.0.0_submission_settings.xml]
[data: dbscripts/xml/upgrade/3.0.0_review_method.xml]
[data: dbscripts/xml/upgrade/3.0.0_edit_decisions.xml]
[data: dbscripts/xml/upgrade/3.0.1_update.xml]
[code: Installer Installer::convertCommentsToEditor]
[note: docs/release-notes/README-3.0]
[note: docs/release-notes/README-3.0.1]
[data: dbscripts/xml/upgrade/3.0.2_update.xml]
[note: docs/release-notes/README-3.0.2]
[code: Installer Installer::moveReviewerFiles]
[code: Installer Installer::fixAuthorGroup]
[data: dbscripts/xml/upgrade/3.0.0_reviewer_files.xml]
ERROR: Upgrade failed: DB: Column 'review_round_id' cannot be null

I executed this query:
SELECT DISTINCT ra.submission_id, ra.round, af.revision FROM review_assignments ra, article_files af, articles a WHERE (ra.submission_id, ra.round) NOT IN (SELECT rr.submission_id, rr.round FROM review_rounds rr) AND a.article_id = ra.submission_id AND af.article_id = a.article_id AND af.file_id = a.review_file_id AND af.round = ra.round;

I look this:

| submission_id| round | revision |
|--- |--- |---|

With the first query:
SELECT ra.review_id, ra.submission_id, ra.reviewer_file_id FROM review_assignments ra WHERE ra.reviewer_file_id IS NOT NULL AND ra.reviewer_file_id NOT IN (SELECT file_id FROM article_files)

I can see this:

review_id | submission_id | reviewer_file_id
|--- |--- |---|

How I want to know other debug from code?
Regards,
OhnO395

Hi @OhnO395,

The query that’s failing to run is:

INSERT INTO review_round_files (submission_id, review_round_id, stage_id, file_id, revision)
SELECT ra.submission_id, ra.review_round_id, 3, ra.reviewer_file_id, sf.revision
FROM review_assignments ra, submission_files sf
WHERE ra.reviewer_file_id IS NOT NULL AND sf.file_id = ra.reviewer_file_id;

You could try running the query referenced here before running the upgrade script:

As always, don’t forget to restore from backup before re-running an upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

thank you @asmecher .
I run:

-CREATE TABLE review_rounds_old SELECT * FROM review_rounds;
-DELETE FROM review_rounds WHERE review_round_id NOT IN (SELECT MIN(review_round_id) FROM review_rounds_old GROUP BY submission_id, round);
-DROP TABLE review_rounds_old;

But still :

I double check this before migrate:

  1. Set journal in maintenance mode.
  2. Migrate from the original 2.4.6 DB from backup.
  3. Code is OJS 3.1.2-1

I run:

select * FROM review_rounds WHERE review_round_id NOT IN (SELECT MIN(review_round_id) FROM review_rounds_old GROUP BY submission_id, round)
no result:
|---|---|---|

Thank you
OhnO395
Thaijo

SELECT ra.submission_id, ra.review_round_id, 3, ra.reviewer_file_id, sf.revision FROM review_assignments ra, submission_files sf WHERE ra.reviewer_file_id IS NOT NULL AND sf.file_id = ra.reviewer_file_id

In the database for Migration, run sql and fix each article_id on dashboard only.

image

fix for me
Thank you.
OhnO395