du-*_*-it 5 where-clause changeset liquibase
如何在"LiquiBase"表示法中定义变更集以更新带有AND-ed WHERE子句的表列:
<changeSet id="ddl update tables : modify datatype for MY_TABLE.STATE_ABBREV" author="xxx">
    <preConditions onFail="MARK_RAN" onFailMessage="Column MY_TABLE.STATE_ABBREV doesn't exists.">
        <and>
            <tableExists tableName="MY_TABLE"/>
            <columnExists tableName="MY_TABLE" columnName="STATE_ABBREV"/>
        </and>
    </preConditions>
    <update tableName="MY_TABLE">
        <column name="STATE_ABBREV" value="AS"/>
        <where>AGU   /***AND STATE_ID=3***/  ??????????????????
        </where>
    </update>
</changeSet>
Nat*_*and 13
放在<where>标记中的内容只是在"WHERE"之后附加到UPDATE语句的末尾.您可以将任何内容放在通常放在SQL中的where标记中.
例:
<changeSet id="ddl update tables : modify datatype for MY_TABLE.STATE_ABBREV" author="xxx">
    <preConditions onFail="MARK_RAN" onFailMessage="Column MY_TABLE.STATE_ABBREV doesn't exists.">
        <and>
            <tableExists tableName="MY_TABLE"/>
            <columnExists tableName="MY_TABLE" columnName="STATE_ABBREV"/>
        </and>
    </preConditions>
    <update tableName="MY_TABLE">
        <column name="STATE_ABBREV" value="AS"/>
        <where>STATE_ABBREV IS NULL AND STATE_ID=3</where>
    </update>
</changeSet>
| 归档时间: | 
 | 
| 查看次数: | 11880 次 | 
| 最近记录: |