I was just trying to set up a new instance of the PIH EMR using the SDK, and it failed during the liquibase updates. We are currently using OpenMRS 2.3.4-SNAPSHOT, so I tried setting up just a 2.3.4-SNAPSHOT instance (ie during SDK setup I chose “Platform” and then manually entered version “2.3.4-SNAPSHOT”) and I’m getting the same error during startup while trying to run the liquibase changesets:
EVERE 11/19/21 10:06 AM:liquibase: Change Set liquibase-update-to-latest.xml::20120504-1020::raff failed. Error: Migration failed for change set liquibase-update-to-latest.xml::20120504-1020::raff: Reason: liquibase-update-to-latest.xml : Empty result set, expected one row : Caused By: Precondition Error liquibase.exception.MigrationFailedException: Migration failed for change set liquibase-update-to-latest.xml::20120504-1020::raff: Reason: liquibase-update-to-latest.xml : Empty result set, expected one row : Caused By: Precondition Error at liquibase.changelog.ChangeSet.execute(ChangeSet.java:285) at liquibase.changelog.visitor.UpdateVisitor.visit(UpdateVisitor.java:27) at org.openmrs.util.DatabaseUpdater$1OpenmrsUpdateVisitor.visit(DatabaseUpdater.java:191) at liquibase.changelog.ChangeLogIterator.run(ChangeLogIterator.java:58) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:220) at org.openmrs.util.DatabaseUpdater.executeChangelog(DatabaseUpdater.java:150) at org.openmrs.web.filter.initialization.InitializationFilter$InitializationCompletion$1.run(InitializationFilter.java:1644) at java.lang.Thread.run(Thread.java:748) Caused by: liquibase.exception.PreconditionErrorException: Precondition Error at liquibase.precondition.core.PrimaryKeyExistsPrecondition.check(PrimaryKeyExistsPrecondition.java:54) at liquibase.precondition.core.NotPrecondition.check(NotPrecondition.java:30) at liquibase.precondition.core.AndPrecondition.check(AndPrecondition.java:34) at liquibase.precondition.core.PreconditionContainer.check(PreconditionContainer.java:199) at liquibase.changelog.ChangeSet.execute(ChangeSet.java:249) ... 7 more
What’s odd is that there are no recent changes to the liquibasechangesets as far as I can see. And this changeset appears to be failing because the “drug_ingredient” table doesn’t exist. Looking at the liquibase history I see that the prior two changesets did run:
20120504-1000 Dropping the drug_ingredient table 10495 2021-11-19 10:06:21 EXECUTED 20120504-1010 Creating the drug_ingredient table 10496 2021-11-19 10:06:21 MARK_RAN
But note that “20120504-1000” appears to run successfully (and drops the drug_ingredient table) but then the one that recreates the table is “marked as run”, which should only else if the table exists.
I’m using to to try deleting changeset “20120504-1010” manually from the change log and see if it successfully creates the table on a re-run.
Take care, Mark