我有变更集
<changeSet id="ABC123" author="davnicwil">
<preConditions onFail="HALT">
<sqlCheck expectedResult="3">SELECT count(*) FROM little_pigs</sqlCheck>
</preConditions>
<sql>DROP TABLE wolf</sql>
</changeSet>
如果little_pigs
中只有2行,则会失败并显示此错误消息
liquibase.exception.MigrationFailedException:
Migration failed for change set migrations.xml::ABC123::davnicwil:
Reason:
migrations.xml : SQL Precondition failed. Expected '3' got '2'
我想要更有意义的错误消息,例如
liquibase.exception.MigrationFailedException:
Migration failed for change set migrations.xml::ABC123::davnicwil:
Reason:
3 little pigs are required to defeat the wolf
对于先决条件,有没有办法配置这样的自定义错误消息?
静态信息很好。如果可以使用动态消息,那就更好了。
答案 0 :(得分:3)
我认为
onFailMessage Custom message to output when preconditions fail. Since 2.0
(http://www.liquibase.org/documentation/preconditions.html)是静态消息所需要的。我没有得到你期望的动态消息&#34;但是你可以使用<customPrecondition>