I am using liquibase inside an application and while performing manual tests, I noticed that preconditions do not behave the same way from the CLI than from my application. From CLI, they all work correctly but from my application, they are always true, causing false positives and failures in the ChangeSet deployment. I tried many precondition formats with native ChangeTypes, sqlChecks and sql like the examples below. The only solution I found that works is to not use preconditions and use a sql ChangeType with an IF condition inside. Is there something wrong in my preconditions or some settings I should set for them to work correctly? I am currently setting the defaultSchema and database on the liquibase object. It is a MSSQL db.
“preConditions”: [
{ "onFail": "MARK_RAN",
"not": {
"columnExists": {
"schemaName": "dbo",
"tableName": "my_table",
"columnName": "my_column"
}
}
}
\],
"preConditions": \[
{ "onFail": "MARK_RAN",
"sqlCheck": {
"expectedResult": "0",
"sql": "SELECT COUNT(1)
FROM information_schema.columns
WHERE table_schema = 'dbo'
AND table_name = 'my_table'
AND column_name = 'my_column'"
}
}
\],