Tried to find an answer to this question, but couldn't.
So, for example I have this table:
TABLE:
col1 | col2
123 0
124 1
and I want to change col2 value to 1 and this is how I'm trying to do it:
<changeSet author="myName" id="7799">
<sql>
UPDATE TABLENAME;
SET COL1='1' WHERE col1='123';
</sql>
</changeSet>
Alas, it doesn't work. So, I was wondering if it is even possible to do that with liquibase? Since, most tags in the documentation have to do with creating table, adding columns etc.
You can use the following liquibase syntax to update:
<changeSet author="myname" id="7799">
<update catalogName="dbname"
schemaName="public"
tableName="TABLENAME">
<column name="COL1" value='1' type="varchar(50)"/>
<where>col1='123'</where>
</update>
</changeSet>
For the other options available please check Liquibase Update
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With