Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Update one row in the table, using liquibase

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

like image 620
user2187935 Avatar asked May 18 '13 18:05

user2187935


People also ask

How do I update my data on Liquibase?

Running the update Change Type To update a table for your database, follow these steps: Step 1: Add the update Change Type to your changeset with the needed attributes as it is shown in the examples. Step 2: Deploy your changeset by running the update command. Now, you should see an updated table.

What is a changeset in Liquibase?

The changeset tag is a unit of change that Liquibase executes on a database and which is used to group database Liquibase Change Types together. A list of changes created by multiple changesets are tracked in a changelog.


1 Answers

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.

like image 118
JavaDevSweden Avatar answered Oct 14 '22 17:10

JavaDevSweden