I don’t know how to check two columns in table migration. I use liquibase. I wanna to make something like this:
"preConditions": [ { "onFail": "MARK_RAN", "not": { "columnExists": { "columnName": "first_column", "tableName": "my_table" }, "columnExists": { "columnName": "second_column", "tableName": "my_table" } } } ]
Advertisement
Answer
not is supposed to be an array of objects. It may add additional logic by using an “and” (default value) or “or” operators.
I’d go with the following:
"preConditions": [{ "onFail": "MARK_RAN", "not": [{ "and": [{ "columnExists": { "columnName": "first_column", "tableName": "my_table" } }, { "columnExists": { "columnName": "second_column", "tableName": "my_table" } }] }] }]