Update one row in the table, using liquibase

user2187935 picture user2187935 · May 18, 2013 · Viewed 43.5k times · Source

I was hoping if someone could verify if this is the correct syntax and correct way of populating the DB using liquibase? All, I want is to change value of a row in a table and I'm doing it like this:

<changeSet author="name" id="1231">
<update tableName="SomeTable">
    <column name="Properties" value="1" />
    <where>PROPERTYNAME = 'someNameOfThePropery"</where>
</update>
<changeSet>

All I want is to change one value in a row in some table. The above doesn't work, although application compiled and it didn't complain, but alas, the value wasn't changed.

Thank you

Answer

JavaDevSweden picture JavaDevSweden · Apr 14, 2017

The above answers are overly complicated, for most cases this is enough:

<changeSet author="name" id="123">
    <update tableName="SomeTable">
        <column name="PropertyToSet" value="1" />
        <where>otherProperty = 'otherPropertyValue'</where>
    </update>
</changeSet>

important to use single quotes ' and not double quotes " in the WHERE clause.