This seems fairly simple in hindsight, but I had a difficult time finding an answer to it, so I putting it down here for posterity’s sake.


SET FOREIGN_KEY_CHECKS=0

I put this as the first changeset in a liquibase xml file. This disables the foreign key and constraint checking in mysql. This would work for other db’s as well, but I haven’t looked up their syntax just yet.

This is in the babble category tagged as ,

Add a comment »

A programmer here at AMPATH (Gilbert Tuwei) had some issues installing mysql. The error message was very unhelpful and the solution was equally puzzling, so I want to put here to for the mighty google to find.

Tuwei was running v5.0.17 of MySQL. Upgrading to version 5.1.31 made the problem disappear.

WARN – InitializationFilter$InitializationCompletion$1.run(823) |2009-10-02 15:24:21,000| Error while trying to update to the latest database version
org.openmrs.util.DatabaseUpdateException: There was an error while updating the database to the latest. file: liquibase-update-to-latest.xml. Error: Migration failed for change set liquibase-update-to-latest.xml::2::upul:
Reason:
java.sql.SQLException: Can’t create/write to file ‘C:\WINDOWS\TEMP\#sql_fe4_0.MYI’ (Errcode: 17):
Caused By: Precondition Error
at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:145)
at org.openmrs.web.filter.initialization.InitializationFilter$InitializationCompletion$1.run(InitializationFilter.java:817)
at java.lang.Thread.run(Unknown Source)
Caused by: liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-update-to-latest.xml::2::upul:
Reason:
java.sql.SQLException: Can’t create/write to file ‘C:\WINDOWS\TEMP\#sql_fe4_0.MYI’ (Errcode: 17):
Caused By: Precondition Error
at liquibase.ChangeSet.execute(ChangeSet.java:204)
at liquibase.parser.visitor.UpdateVisitor.visit(UpdateVisitor.java:26)
at org.openmrs.util.DatabaseUpdater$1OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:177)
at liquibase.parser.ChangeLogIterator.run(ChangeLogIterator.java:41)
at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:201)
at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:142)
… 2 more
Caused by: liquibase.exception.PreconditionErrorException: Precondition Error
at liquibase.preconditions.ForeignKeyExistsPrecondition.check(ForeignKeyExistsPrecondition.java:36)
at liquibase.preconditions.NotPrecondition.check(NotPrecondition.java:18)
at liquibase.preconditions.AndPrecondition.check(AndPrecondition.java:21)
at liquibase.ChangeSet.execute(ChangeSet.java:169)
… 7 more

This is in the babble category tagged as , , ,

Add a comment »