This is what I have
--preconditions onFail:CONTINUE
--preconditions not tableExists tableName:QRTZ_CALENDARS schemaName:dbo
CREATE TABLE dbo.QRTZ_CALENDARS (
SCHED_NAME VARCHAR (120) NOT NULL ,
CALENDAR_NAME VARCHAR (200) NOT NULL ,
CALENDAR IMAGE NOT NULL
)
GO
Background. I'm using liquibase to setup a h2 database for test cases in java.
At the moment "formatted SQL" changelogs only support the "SQL check" precondition. Example:
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:0 SELECT COUNT(*) FROM my_table
Info source (and updates): https://docs.liquibase.com/concepts/changelogs/preconditions.html
If more complicated preconditions are required -- one could try moving to a non-SQL Liquibase format, i.e. XML or JSON