4rp*_*pit 4 mysql sql database liquibase drop-table
我只想在存在表的情况下使用Liquibase在MySQL中删除表。
我无法弄清楚如何检查Liquibase中是否存在表。
谢谢。
你应该用
<changeSet author="liquibase-docs" id="dropTable-example">
<preConditions onFail="MARK_RAN"><tableExists schemaName="schemaName" tableName="tableName"/></preConditions>
<dropTable cascadeConstraints="true"
catalogName="cat"
schemaName="public"
tableName="person"/>
</changeSet>
Run Code Online (Sandbox Code Playgroud)
另外,您可以检查此链接以获取更多<preConditions>选项:http :
//www.liquibase.org/documentation/preconditions.html