OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Database version is older than code version problem with OJS

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
What to do if you have a technical problem with OJS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OJS Editorial Support and Discussion subforum; if you have a development question, try the OJS Development subforum.

Database version is older than code version problem with OJS

Postby sjones » Tue Mar 20, 2012 8:56 am

I'm stuck trying to upgrade to OJS 2.3.7 from 2.3.6. I get the "Database version is older than code version" message when running php tools/upgrade.php patch.

When I run php tools/upgrade.php upgrade to upgrade the database it seems to not actually upgrade it, it continues to show the database version as 2.3.4.0. This is under PHP 5.2.17. The text below shows what happens. I'll appreciate any advice about how to proceed.

Thank you,

Steve

$php tools/upgrade.php patch
Code version: 2.3.6.0
Database version: 2.3.4.0
Latest version: 2.3.7.0
Database version is older than code version
Run "tools/upgrade.php upgrade" to update
$ php tools/upgrade.php upgrade
[pre-install]
[load: upgrade.xml]
[version: 2.3.4.0]
[data: dbscripts/xml/upgrade/public_issue_ids.xml]
[post-install]
Successfully upgraded to version 2.3.4.0
$ php tools/upgrade.php patch
Code version: 2.3.6.0
Database version: 2.3.4.0
Latest version: 2.3.7.0
Database version is older than code version
Run "tools/upgrade.php upgrade" to update
sjones
 
Posts: 46
Joined: Sun Jan 29, 2006 8:47 am

Re: Database version is older than code version problem with

Postby JasonNugent » Tue Mar 20, 2012 11:56 am

Hi Steve,

It sounds like you've got a mix of content there. How did you get to 2.3.6 originally? Can you have a look at the xml/upgrade.xml and xml/install.xml files and see what they say as a version in the 'install' tag at the top?

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 886
Joined: Tue Jan 10, 2006 6:20 am

Re: Database version is older than code version problem with

Postby sjones » Tue Mar 20, 2012 12:10 pm

Thanks for the quick reply. Where do these files live?
sjones
 
Posts: 46
Joined: Sun Jan 29, 2006 8:47 am

Re: Database version is older than code version problem with

Postby sjones » Tue Mar 20, 2012 12:14 pm

Found them in dbscripts/xml.

The install.xml file shows: <install version="2.3.6.0">

The upgrade.xml file shows: <install version="2.3.4">

Thanks,

Steve
sjones
 
Posts: 46
Joined: Sun Jan 29, 2006 8:47 am

Re: Database version is older than code version problem with

Postby JasonNugent » Wed Mar 21, 2012 6:28 am

Hi Steve,

If I was attempting to fix this, I'd start with a fresh installation of 2.3.6 (a full download of the source tarball) in order to make sure I had the most recent database upgrade scripts. I'd then use that to get to 2.3.6, verify that things were in sync (2.3.6 for both code and database), and then go to 2.3.7.

As always, before doing things like this make sure you've a recent version of your database and site backed up.

Regards,
Jason
JasonNugent
Site Admin
 
Posts: 886
Joined: Tue Jan 10, 2006 6:20 am

Re: Database version is older than code version problem with

Postby ramon » Fri May 25, 2012 10:54 am

Hello Jason,

Attempting to upgrade a test install, which was first installed in 2009 and continuously upgraded ever since, I came across the following error after patching:
Code: Select all
[data: dbscripts/xml/upgrade/2.3.5_update.xml]
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '300 AND UNIX_TIMESTAMP(pa.date_published) - UNIX_TIMESTAMP(a.date_submitted) = 0' at line 1


I searched and applied manually the following SQL command
Code: Select all
ALTER TABLE published_articles CHANGE COLUMN date_published date_published
DATETIME;
UPDATE published_articles pa, articles a SET pa.date_published = NULL WHERE
a.article_id = pa.article_id AND UNIX_TIMESTAMP(pa.date_published) -
UNIX_TIMESTAMP(a.date_submitted) < 300 AND UNIX_TIMESTAMP(pa.date_published) -
UNIX_TIMESTAMP(a.date_submitted) >= 0


and tried upgrading again, which failed.

I then picked a fully patched 2.3.7 version and added my database and previous config.inc.php info in it, but upgrading the dbase also failed (there's no backup....)

I'm wondering if I can remove the previous versions or not:
Code: Select all
 2.3.3_update.xml
2.3.4_update.xml
2.3.5_update.xml


And, if that will prevent the upgrade, or help it.
It's not a production version, and may have become corrupted from failed upgrades, but I wondered if anyone faced this problem and how they solved it...
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Database version is older than code version problem with

Postby ramon » Thu Jun 28, 2012 8:24 am

Hello all,

I'm trying to upgrade a 2.2.2.0 OJS version but every attempt is throwing the following error:
Code: Select all
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '300 AND UNIX_TIMESTAMP(pa.date_published) - UNIX_TIMESTAMP(a.date_submitted) = 0' at line 1


Where do I start looking to see how I fix this?

Apparently the problem is in dbscripts/xml/upgrade/2.3.5_update.xml.

However, this server is running an old version of PHP, because we need to test with previous versions, so I don't know if that may be causing some issues.

Looking at the phpinfo(), here's the result:
PHP Version 5.2.6-3ubuntu4.6
Apache/2.2.11
It has both MySQL and MySQLi enabled.
Could this pose a problem?
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Database version is older than code version problem with

Postby ramon » Thu Jul 05, 2012 11:27 am

Hello all,

Again, answering my own questions.

I believe my problem with the following error:
Code: Select all
ERROR: Upgrade failed: DB: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '300 AND UNIX_TIMESTAMP(pa.date_published) - UNIX_TIMESTAMP(a.date_submitted) = 0' at line 1

Is due to a PHP version issue.
Trying to upgrade a 2.2.4 to 2.3.7 on a PHP 5.2 generates that error all the time.
When upgrading in a 5.3 environment, the problem disappears...


_______________________________
Ramón Martins Sodoma da Fonseca
Analista em C&T
Coordenação de Tecnologias de Informação
Instituto Brasileiro de Informação em Ciência e Tecnologia - IBICT
Ministério da Ciência e Tecnologia - MCT
ramon
 
Posts: 931
Joined: Wed Oct 15, 2003 6:15 am
Location: Brasí­lia/DF - Brasil

Re: Database version is older than code version problem with

Postby ronniebrito » Wed Dec 04, 2013 9:32 am

thank you Ramon!
ronniebrito
 
Posts: 6
Joined: Fri Mar 08, 2013 9:48 am
Location: Brasília - Brasil


Return to OJS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 3 guests