Liquibase 提供更新功能,更新列中的整个值。有没有办法只替换一部分值?或者我必须使用普通的 sql 语句吗?
该列中的值如下所示:
downtime = maintenanceTime + rampUpTime + repairTime;
Run Code Online (Sandbox Code Playgroud)
打电话时
downtime = maintenanceTime + rampUpTime + repairTime;
Run Code Online (Sandbox Code Playgroud)
它翻译成
<changeSet author="faf" id="29.10.19-16:34-001">
<update tableName="PARAMETER">
<column name="VALUE" type="varchar(64)" value="setupTime" />
<where>VALUE LIKE '%rampUpTime%'</where>
</update>
</changeSet>
Run Code Online (Sandbox Code Playgroud)
我正在寻找类似的东西,它将被翻译成
UPDATE parameter set VALUE = 'setupTime' where VALUE like '%rampUpTime%'
Run Code Online (Sandbox Code Playgroud)
Liquibase 不提供REPLACE,但它提供标签的valueComputed属性<update>。
我认为以下应该可以解决问题:
<changeSet author="faf" id="29.10.19-16:34-001">
<update tableName="PARAMETER">
<column name="VALUE" type="varchar(64)" valueComputed="REPLACE(VALUE, 'rampUpTime', 'setupTime')" />
<where>VALUE LIKE '%rampUpTime%'</where>
</update>
</changeSet>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1046 次 |
| 最近记录: |