I am new to liquibase, I am executing a sql changeset file where the preconditions are
–precondition-sql-check expectedResult:0 SELECT count(*) FROM weather_data WHERE id=1 ;
There is already id of 1 is present in db, so the expected result is not 1,
Now I am execpecting this precondition has failed, I need to skip this changeset as I mentioned the on fail as continue , but the result is
Unexpected error running Liquibase: Migration failed for changeset weatherPrecondition.sql::8::suriya:
…/com/example/baseChangelog.xml : SQL Precondition failed. Expected ‘0’ got ‘1’
- Caused by: Preconditions Failed
I would expect to see that error message when the precondition fails, but the changelog should continue to execute. The docs are here: Preconditions
My question is: Does the changelog stop executing after that error message in your case? Is there any other output from the command you can share?
I think what you want to do is:
Which will mark the changeset as executed in the databasechangelog, without actually running it, and continue to the next changeset.
Yeah, It is stop executing after this. That is all the log I got.
But it should mark the changeset as failure in databasechangelog table, at the same time it should continue with next changeset file
Liquibase only records successful changesets in the databasechangelog table, never failures.
Here are your options: