Liquibase回滚自定义SQL

时间:2010-08-04 19:59:17

标签: java migration liquibase

我无法弄清楚如何在变更集中回滚自定义Sql。有什么想法吗?

我想这样做:

<changeSet author="Charlie White" id="15" runAlways="false" runOnChange="false" failOnError="true">
<sql> 
INSERT INTO `XXXX` (`CONFIG_ID`,`NAME`,`VALUE`) VALUES YYYY;
</sql>
<rollback>
     DELETE FROM 'XXXX" WHERE 'YYYY";
</rollback>

或者可能这样:

<changeSet author="Charlie White" id="15" runAlways="false" runOnChange="false" failOnError="true">
<sql> 
INSERT INTO `XXXX` (`CONFIG_ID`,`NAME`,`VALUE`) VALUES YYYY;
</sql>
<rollback> <sql>
     DELETE FROM 'XXXX" WHERE 'YYYY";
</sql></rollback>

感谢您的帮助。

1 个答案:

答案 0 :(得分:2)

应该是第一个:

<changeSet author="Charlie White" id="15" runAlways="false" runOnChange="false" failOnError="true">
    <sql> 
    INSERT INTO `XXXX` (`CONFIG_ID`,`NAME`,`VALUE`) VALUES YYYY;
    </sql>
    <rollback>
     DELETE FROM 'XXXX" WHERE 'YYYY";
   </rollback>
</changeSet>