基于Liquibase xml的变更集块:
<preConditions>
<not>
<tableExists tableName="alarm" schemaName="public"/>
</not>
</preConditions>
在“ liquibase格式的sql”中应该如何显示? Liquibase的官方文档仅给出基于xml的
答案 0 :(得分:2)
使用此:
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:0 SELECT count(*) FROM information_schema.tables where table_name = 'alarm';
expectedResult
是liquibase中的String,求值将进行String比较。因此,无论您的sql返回什么,都需要完全匹配(包括区分大小写)。
您还可以检查单元测试类FormattedSqlChangeLogParserTest以获取更多示例。