Database update error. Openvpms 2.3

Hi,

Solved the problem myself - well with the help of info I found with a google search.

I will leave the posting up in case helpful for anyone else.

Please advise if I need to do anything to amend for skipping update OBF-272.

 

The work around:

I disabled the foreign key checks in mysql/openvpms database with : 

SET GLOBAL FOREIGN_KEY_CHECKS=0;

and once the update completed reversed it with

SET GLOBAL FOREIGN_KEY_CHECKS=1;

(you could leave out the GLOBAL if you think you can sort it in one session without having to restart mysql

due to a typo.)

 

The issue:

Decided to try and get the database updated and come across this error -

Updating to 2.1.0.24 - OBF-272 ... Migration of schema `openvpms` to version 2.1.0.24 - OBF-272 failed! Please restore backups and roll back database and code!

Migration V2.1.0.24__OBF-272.sql failed
---------------------------------------
SQL State  : 23000
Error Code : 1452
Message    : Cannot add or update a child row: a foreign key constraint fails (`openvpms`.`#sql-1ea4_2a`, CONSTRAINT `FKBB44EA17AB042EA8` FOREIGN KEY (`entity_relationship_id`) REFERENCES `entity_relationships` (`entity_relationship_id`))
Location   : org/openvpms/db/migration/2.1/V2.1.0.24__OBF-272.sql (C:\openvpms-release-2.3.0.11\bin\file:\C:\openvpms-release-2.3.0.11\lib\openvpms-db-2.3.0.11.jar!\org\openvpms\db\migration\2.1\V2.1.0.24__OBF-272.sql)
Line       : 154
Statement  : CALL sp_add_foreign_key('entity_relationship_details', 'FKBB44EA17AB042EA8', 'entity_relationship_id',
                        'entity_relationships', 'entity_relationship_id')

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Database update error. Openvpms 2.3

I haven't seen this error before. How did you resolve the issue? Restore a backup, disable foreign key checks and then re-run the upgrade?

Note that you can't do a partial upgrade. If you can't complete it successfully, you will need to restore the database back to the prior version and run against that version. Failure to do so can lead to data corruption.

Please contact support[at]openvpms[dot]com if you have further issues.

Re: Database update error. Openvpms 2.3

Hi,

 I discarded mysql database and setup again then restored database from earlier version from backup. Then disabled the foreign key check ran database update and enabled foreign key check again. 

Syndicate content