Is it possible to update an existing row in a database using lipibase?

I tried to find the answer to this question, but could not.

So, for example, I have this table:

Table:

col1 | col2 123 0 124 1 

and I want to change the value of col2 to 1, and that’s how I am trying to do this:

 <changeSet author="myName" id="7799"> <sql> UPDATE TABLENAME; SET COL1='1' WHERE col1='123'; </sql> </changeSet> 

Alas, that will not work. Therefore, I was wondering, is it possible to do this with lipibase? Since most of the tags in the documentation are related to creating a table, adding columns, etc.

+8
database oracle liquibase
source share
1 answer

You can use the following Liquibase syntax to upgrade:

 <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 other options available, please check Liquibase Update.

+17
source share

All Articles