Can't upgrade database
Submitted by Canberravillage... on Thu, 14/06/2018 - 15:31
Hi All
One of the installs I manage is failing an upgrade to OpenVPMS 2.0. The current installation is 1.9.3 with mysql 5.5, and tomcat 7 on Debian Jessie.
Running
$ dbtool --update
results in the following error:
org.flywaydb.core.api.FlywayException: Detected failed migration to version 1.9.0.1 (OVPMS-1821)
Any pointers to debug this one?
Cheers
Damien
Re: Can't upgrade database
If you had run the update previously, errors should be logged in <OPENVPMS_HOME>/bin/openvpms.log
If that doesn't narrow the problem down, you can get more information about what is going on by editing <OPENVPMS_HOME>/conf/log4j.properties and adding:
and then rerunning the command.
Re: Can't upgrade database
Damien,
I might be totally wrong about this in your case as I am just running on memory. But I seem to recall running into this error myself. The fix at the time for me was found in the Upgrade an Existing System > Migration Notes >#3:
"If you are 're-migrating', ie you have an OpenVPMS 2.0 system that you are restoring a 1.9 database into, then you will need to drop the schema_version table. This is used by dbtool to record the version information, and this table will not be deleted by restoring your 1.9 database, so you will need to manually delete it using the mysql command: drop table schema_version;"
After dropping the table and rerunning the dbtool, than all went well.
Hope this helps.
Sam
Re: Can't upgrade database
Note that dropping the schema_version table is relevant when restoring a 1.9 backup into a database that has had 2.0 previously, but is not a general solution to migration problems.
If a migration has been partially or fully run in the past, dropping the schema_version table will cause every migration to be re-applied the next time dbtool --update is invoked.
Some migrations are not designed to be run more than once, and could lead to data corruption.
In the above case, the first migration for OVPMS-1821 is failing. You can probably get away with dropping the table as there is no prior migration, and that particular migration is re-runnable. It would be better to identify the cause however.
Re: Can't upgrade database
Hi Tim and Sam
I successfully followed Sam's advice to complete migration for this database.
Tim, I have saved a copy of the database that exhibits the upgrade error. I will debug it as time permits - time currently does not!
Many thanks to you both
Damien