我需要更改包含以下内容的列的所有值 autor
子串到 author
.
例如:我的当前行是 我的当前行是 role-autor
而这需要成为 role-author
在liquibase中可以吗?
类似这样。
<update tableName="your_table_name">
<column name="role-autor" type="varchar(64)" valueComputed="REPLACE(role-autor, 'autor', 'author')" />
<where>role-autor LIKE '%autor%'</where>
</update>
请研究一下StackOverflow博客,那里有一些例子可以帮助你。
你需要把它放在变化集标签中。
<changeSet author="wiki" id="1.0.0-1">
<update tableName="your_table_name">
<column name="role-autor" type="varchar(64)" valueComputed="REPLACE(role-autor, 'autor', 'author')" />
<where>role-autor LIKE '%autor%'</where>
</update>
</changeset>
关于变化集标签的更多细节,请阅读。https:/docs.liquibase.comconceptsbasicchangeset.html。
你只是想 replace()
?
update t
set col = replace(col, 'autor', 'author')
where col like '%autor%';