Home:ALL Converter>Liquibase preconditions to all changelog file in sql

Liquibase preconditions to all changelog file in sql

Ask Time:2020-01-17T01:26:39         Author:Cedric C

Json Formatter

I would like to run a SQL precondition checking for each changeSet in my SQL changeLogFile. It is actually a precondition on the changeLog itself

Here is an extract of it :

--liquibase formatted sql

--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:"1.0" SELECT VERSION FROM VERSION_TABLE;

--changeset bob:1 failOnError:true dbms:oracle
ALTER INDEX XXX RENAME TO YYY;
--rollback YYY RENAME TO XXX;

Even if the precondition is actually not respected, liquibase still run all the changeset.

Does somebody knows if it is an error from my side or if liquibase does not allow preconditions on entire changeLog for SQL changeLog file ?

Thanks in advance !

Author:Cedric C,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/59774917/liquibase-preconditions-to-all-changelog-file-in-sql
Pranjal Kumar :

If you go through the documentation, then its stated that we can only apply pre-conditions on a specific change set. Also, only the SQL Check precondition is supported. \n\nLiquibase doc for sql changelog files - https://www.liquibase.org/documentation/sql_format.html",
2020-02-25T06:17:44
yy