Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to insert html tag inside sql in Liquibase migration?

I need to update my data that have html tag inside so wrote this on liquibase

<sql> update table_something set table_content = " something <br/> in the next line " </sql>

it apparently doesn't work on liquibase ( i got loooong errors .. and meaningless). I tried to remove <br/> and it works.

my question is, is it possible to insert / update something that contains xml tag in Liquibase ?

I am using liquibase 1.9.3 with Grails 1.1.1

edited: forgot to set code sample tag in my examples.

like image 391
nightingale2k1 Avatar asked Jul 04 '09 15:07

nightingale2k1


People also ask

Can Liquibase migrate data?

Liquibase offers a powerful open source database migration tool for Java apps. It brings structure and confidence to developers and DBAs that need to easily create and track database schema changes.

What is a Liquibase tag?

The tag command is typically used to mark the current database state, version, release, or any other information by adding the tag to the last row in the DATABASECHANGELOG table. After setting the tag, you can use the rollback command to roll back all changes up to that tag.

Does Liquibase support SQL?

Yes, Liquibase really can work with SQL scripts. In fact, our recent Liquibase survey revealed that most of our users prefer using SQL scripts over the other Liquibase changelog options, like XML, JSON, and YAML.


1 Answers

As the liquibase author mentions here you'll need to add CDATA section inside <sql>.

In your particular example that would become:

<sql><![CDATA[ update table_something set table_content = " something <br/> in the next line " ]]></sql>
like image 63
Jorge Alves Avatar answered Sep 19 '22 15:09

Jorge Alves