2010-08-04 119 views
2

我無法弄清楚如何在變更集中回滾自定義Sql。有什麼想法嗎?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> 

感謝您的幫助。

回答

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>