Search code examples
sqlxmlliquibasemultilinechangeset

Liquibase: mutli-line value


I want to update a value (replace unencrypted with encrypted password) in the database that is two lines. For example:

some_random_characters
and_some_more

I've made a Liquibase changeSet like this:

   <changeSet id="1" author="KevinC" logicalFilePath="...">
     <update tableName="USERS">
       <column name="PASSWORD" value="some_random_characters
and_some_more" /> <!-- NOTE: Enter is part of the hash -->
       <where>USR_ID = '1'</where>
     </update>
   </changeSet>

As you may have guessed, it is saved as some_random_characters and_some_more in the database. How can I add a multi-line value to a database column with a Liquibase changeSet?
(PS: The DATA_TYPE of the PASSWORD database-column is VARCHAR2(512 BYTE).)


Solution

  • XML considers whitespace as irrelevant, so you will probably need to wrap your data in a CDATA tag.