Upgrading 2.4.8 to 3.2.1-5: DB Error: ERROR: column "a.context_id" must be appear

During an upgrade from version 2.4.8 to 3.2.1, I received this error in the image.

I looked for similar forums but didn’t find a solution to this problem.

PHP version: 7.4
Database: Postgres13
Distro: Debian 11

How to solve?

Hi @Yorranan,

That is a very old piece of code and I have to admit I don’t recall well how the database structures for 2.x and 3.0 looked. The error is probably occurring because MySQL has gotten more strict over the years about query structures; previously this would’ve run without complaint, but newer versions now throw a fatal error.

If you can accept losing continuity in your statistics processing with the upgrade, I would suggest editing dbscripts/xml/upgrade.xml and removing the following line (around line 115):

<code function="migrateTimedViewsUsageStatistics" condition="return $installer->tableExists('timed_views_log');" />

Then restore your database etc. from backup and try re-running the upgrade. This will skip the step that is failing.

Thanks,
Alec Smecher
Public Knowledge Project Team

Thanks for the help! I’m now trying to update my test server, hopefully I’ll have some good news after this weekend. I’ve been having some problems with it, but I found solutions in these discussions:
Can’t finish upgrade error
Loss of all of articles upgrading ojs-3.1.2.4 to ojs-3.2.0-3
Error upgrade ojs 2.4.8.5 > 3.2.1.4
Erro função getid null ojs upgrade - IBICT forum

Also, the update is taking over 9 hours, I don’t know if that was expected. The documentation says it can take several hours, but it’s weird. Fact: my dir files are over 20GB+

1 Like

Hi @Yorranan,

Good luck!

Once you get to 3.3.0-x and especially 3.4.0-x, upgrades will get a lot easier and faster. Stick with it, it’ll be worthwhile and save a lot of future pain!

Thanks,
Alec Smecher
Public Knowledge Project Team

This topic was automatically closed after 9 days. New replies are no longer allowed.