OJS Database version older than code version

Hello,

We have to update from OJS 2.4.4.1 to OJS 2.4.7.0.
The problem is that the database is reporting to be versión 2.3.4.0 (We have updated from that versión to 2.4.4.1 long time ago).
Apparently the 2.4.4.1 is working with an inconsistent database.

When checking versions with “php tools/upgrade.php check” command the result is:
Code version: 2.4.4.1
Database version: 2.3.4.0
Latest version: 2.4.7.0
Database version is older than code version
Run “tools/upgrade.php upgrade” to update

And when we run that the reult is:
admin@aaot.org.ar [~/subdomains/ojs/ojsr]# php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.4.4.1]
[schema: lib/pkp/xml/schema/signoff.xml]
[data: dbscripts/xml/upgrade/2.4.3_preupdate_usageStatistics.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.3_preupdate_usageStatistics2.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_article_files.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_emaillog.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_preupdate_reviewrounds.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_issues.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_articles.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_published_articles.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_issue_galleys.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_article_galleys.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_idupgrade_supp_files.xml (skipped)]
[data: dbscripts/xml/upgrade/2.4.0_notifications.xml (skipped)]
[schema: lib/pkp/xml/schema/common.xml]
[schema: lib/pkp/xml/schema/groups.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/comments.xml]
[schema: lib/pkp/xml/schema/notes.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/metrics.xml]
[schema: dbscripts/xml/ojs_schema.xml]
[data: dbscripts/xml/indexes.xml]
[data: dbscripts/xml/upgrade/2.3.5_update.xml]
[note: docs/release-notes/README-2.3.5]
[note: docs/release-notes/README-2.3.6]

[code: Installer Installer::migrateReviewingInterests2]
[data: dbscripts/xml/upgrade/2.3.7_update.xml]

[code: Installer Installer::removeAuthorRevisedFilesFromSignoffs]
[note: docs/release-notes/README-2.3.7]

[code: Installer Installer::installEmailTemplate]

[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/2.4.0_idupgrade_article_galleys2.xml (skipped)]
[data: lib/pkp/xml/mutexData.xml]
[data: dbscripts/xml/upgrade/2.4.0_update.xml]
ERROR: Upgrade failed: DB: Table ‘aaot_org_ar_ojs.article_event_log’ doesn’t exist

Is there any way this can be solved without restoring the database from the a backup prior to the previous version update?.

It is possible to manually adjust the current database structure to make it consistent to version 2.4.4.1 so we can then update to OJS ver 2.4.7.0?

Can you point us to someone who has the necesary skills to do this?

We do not want to lose almost two years of information updates to the database.

Thanks in advance,

Manrique

I’ve not actually run into this issue before, but if I were approaching it, my strategy would be:

  1. Ensure you have backups
  2. Restore the database and code to just before the upgrade.
  3. Run php tools/upgrade check. This should report the database at 2.3.4, and the code at 2.4.4.1.
  4. If confirmed, run php tools/upgrade upgrade
  5. Upgrade the code to 2.4.7.
  6. Run php tools/upgrade check and php tools/upgrade upgrade as normal.

Thank you ctgraham but we are trying no to loose almost two years of data in the database.
As you can see in the last part of our post the questions are:

"Is there any way this can be solved without restoring the database from the a backup prior to the previous version update?.

It is possible to manually adjust the current database structure to make it consistent to version 2.4.4.1 so we can then update to OJS ver 2.4.7.0?

Can you point us to someone who has the necesary skills to do this?

We do not want to lose almost two years of information updates to the database."

Thanks in advance,

Manrique

Hi @Manrique,

I suspect your earlier upgrade from 2.3.4 to 2.4.4-1 didn’t complete successfully, and this left your system in an inconsistent state somewhere between the two versions.

Unfortunately without the output from that upgrade process it’s impossible to know how far the upgrade got before it failed, so I don’t know how much of a problem this will be going forward. If you’ve been operating for a long time with the inconsistent database, then I suspect most of your data will be consistent with OJS 2.4.4-1 and for lack of a better recommendation I would suggest changing your database manually to the 2.4.4-1 version.

To do that, you’ll need to edit the contents of the versions table, find the entry with current=1 that refers to the core OJS product (which will be currently at version 2.3.4), and change it to 2.4.4-1.

Then follow @ctgraham’s instructions to run the upgrade from 2.4.4-1 to 2.4.7.

Please back everything up before you start this process. Without knowing what failed in your earlier upgrade, I can’t predict whether this is going to work error-free.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you asmecher,

What do whould it happen whith the error line error line in my post “ERROR: Upgrade failed: DB: Table ‘aaot_org_ar_ojs.article_event_log’ doesn’t exist” in that case?

Many thanks,

Manrique

@Manrique, let me clarify that I wasn’t suggesting going to the two year old backup, but to the backup just before you tried the 2.4.7 upgrade.

@asmecher, my concern with marking the database as already upgraded is something like the article_event_log being missing, which I suspect should have been added in the database changes between 2.3.4 and 2.4.4-1. Wouldn’t it be safer to rerun the 2.3.4 → 2.4.4-1 database upgrades entirely?

Hi @ctgraham,

My sense is that @Manrique’s database was partially (but not completely) upgraded from 2.3.4 to 2.4.4-1 a long time ago, and has been running in production for some time since then with a 2.4.4-1 codebase. That’ll mean the database is mostly 2.4.4-1 with a mix of some older 2.3.4 stuff that wasn’t upgraded fully.

@Manrique:

What do whould it happen whith the error line error line in my post “ERROR: Upgrade failed: DB: Table ‘aaot_org_ar_ojs.article_event_log’ doesn’t exist” in that case?

That error is coming up because OJS is trying to run part of the 2.3.4 to 2.4.4-1 upgrade that has already been completed. If you change the version number as I recommended above, it’ll skip this part of the upgrade.

Regards,
Alec Smecher
Public Knowledge Project Team

Thank you @asmecher and @ctgraham for your replies.

We´ve edited the version number at the database as @asmecher suggested and now the result of the “php tools/upgrade.php check” command is reflecting that change correctly. So both the Code version ant the Database version are shown as 2.4.4.1.

At this point what upgrade method do you reccomend?

Many thanks,

Manrique

Hi @Manrique,

I would suggest following the “full package upgrade” process described in docs/README to upgrade your code to OJS 2.4.7, if you haven’t already done that. Then run the database upgrade tool:

php tools/upgrade.php upgrade

…to upgrade your database from 2.4.4-1 to 2.4.7.

Please make sure you have a fresh backup of everything before you do this, just in case.

At the end of the process, you should see a confirmation that you’ve successfully upgraded to OJS 2.4.7.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher ,

Thanks a lot for your advice!!!

We followed your suggestion and it seems that all went well without errors.
Now the “php tools/upgrade.php check” command´s result shows that the Database and the Code are version 2.4.7

To make sure that everything is the way its supposed to be, is there any tool that checks the integrity of the database and it structure compliance to the version 2.4.7 regarding the version information stored in the version table?

The next step is to compare and update and configure the old version of config.inc.php with the added lines in the new version. Then we´ll try to use the new features like DOI sync to CrossRef and see what happens.

Thanks again for your help,

Manrique

Hi @Manrique,

No, we don’t have a database check tool, but I’d suggest clicking around for a few minutes to various parts of the system (reviewing your setup; viewing a few articles; etc) and double-checking that nothing unusual appears in your PHP error log. Feel free to post here if you run into something strange.

Regards,
Alec Smecher
Public Knowledge Project Team