liquibase preconditions yaml
this topic is poor documented, but after many tries... you can write something like this:
databaseChangeLog: - changeSet: id: 1 author: pazfernando preConditions: - onFail: MARK_RAN - tableExists: schemaName: sa tableName: PROVEEDORBIENSERVICIO changes: - renameTable: newTableName: PROVEEDORBIENSERVICIO oldTableName: PROVEEDORSERVICIO schemaName: sa
Here is another example with the sqlCheck
:
preConditions: - onFail: CONTINUE - onError: CONTINUE - sqlCheck: expectedResult: 0 sql: select count(*) from oss_organization where Status is null - sqlCheck: expectedResult: 0 sql: select count(*) from oss_organization where Type is null
The following seems to work:
databaseChangeLog: - changeSet: id: 1 author: mraible preConditions: onFail: MARK_RAN not: sequenceExists: schemaName: public sequenceName: hibernate_sequence changes: - createSequence: sequenceName: hibernate_sequence
Syntax for sqlCheck condition:
databaseChangeLog:- changeSet: id: changeSet-id author: myName preConditions: - onFail: MARK_RAN - sqlCheck: expectedResult: 1 sql: "select count(*) from foo where some-condition" changes: - sql: "your sql script"