Upgrade database from OJS 2.4.2.0 to OJS 3.0.2.0 error

Dear PKP,

I try to upgrade my OJS 2.4.2.0 installation to OJS 3.0.2.0 and the database upgrading process (using command line ‘php tools/upgrade.php upgrade’) fails with the following error:

[pre-install]
[load: upgrade.xml]
[version: 3.0.2.0]
[code: Installer Installer::syncSeriesAssocType]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics.xml]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics2.xml]
[data: dbscripts/xml/upgrade/3.0.0_preupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptTimedViews.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptReferrals.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptBooksForReview.xml]
[data: dbscripts/xml/upgrade/remove_timed_views_bots.xml]
[code: Installer Installer::migrateCounterPluginUsageStatistics]
[code: Installer Installer::migrateTimedViewsUsageStatistics]
[code: Installer Installer::migrateDefaultUsageStatistics]
<h1>DB Error: Table 'db_ojs.metrics' doesn't exist</h1>ojs2: DB Error: Table 'db_ojs.metrics' doesn't exist

How can fix this issue?

Hi @mihaiug

Ah, apparently the usage statistics and thus DB table metrics came first in 2.4.3 :-
Could you then please first restore your backup, then change the upgrade script so:
move these lines ojs/upgrade.xml at ojs-stable-3_0_2 · pkp/ojs · GitHub
in front of this line ojs/upgrade.xml at ojs-stable-3_0_2 · pkp/ojs · GitHub,
and then try the upgrade again?

Thanks a lot!
Bozana

Hi @bozana,

I try to follow your instructions and now the following error is obained:

php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 3.0.2.0]
[code: Installer Installer::syncSeriesAssocType]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics.xml]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_usageStatistics2.xml]
[data: dbscripts/xml/upgrade/3.0.0_preupdate.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptTimedViews.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptReferrals.xml]
[data: dbscripts/xml/upgrade/3.0.0_adaptBooksForReview.xml]
[data: dbscripts/xml/upgrade/remove_timed_views_bots.xml]
[data: dbscripts/xml/upgrade/3.0.0_preupdate_commentsToEditor.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/notes.xml]
[schema: lib/pkp/xml/schema/views.xml]
[schema: lib/pkp/xml/schema/genres.xml]
[schema: lib/pkp/xml/schema/gifts.xml]
[schema: lib/pkp/xml/schema/mutex.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: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]
[code: Installer Installer::migrateCounterPluginUsageStatistics]
[code: Installer Installer::migrateTimedViewsUsageStatistics]
[code: Installer Installer::migrateDefaultUsageStatistics]
<h1>DB Error: Unknown column 'issue_id' in 'field list'</h1>ojs2: DB Error: Unknown column 'issue_id' in 'field list'

Hi @mihaiug

Ah, sorry, I forgot that the issue_id column is not there any more at the place where we moved the scripts now.
Here is the whole fix: pkp/pkp-lib#2295 upgrade of old statistics to 3.x · bozana/ojs@fc73c76 · GitHub
Could you try that? – I do not have such an old OJS version, so I could only test it with OJS 2.4.8. If this does not work for you and if you want, you can also send me (bozana dot bokan at posteo dot net) you DB dump without sensitive data and I could test it locally…

Thanks a lot and sorry for this “back-and-forth” :-
Best,
Bozana

Hi @bozana,

The patch works perfectly.
Thank you very much!

Best regards,
Mihai Gabroveanu