2009-07-04 66 views
9

我需要更新我的数据有HTML标记内部,写了这对liquibase如何在Liquibase迁移中的sql中插入html标签?

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

它显然不会对liquibase工作(我得到过长... ..错误和毫无意义的)。我试图删除<br/>,它的工作原理。

我的问题是,是否可以在Liquibase中插入/更新包含xml标签的东西?

我使用liquibase 1.9.3与1.1.1的Grails

编辑:忘了设定的代码示例代码在我的例子。

+0

你的问题不真的很清楚。你能解释一下你的设置是什么吗?您是直接使用liquibase XML来定义变更集,还是使用autobase grails插件提供的DSL?是你的“更新..”你尝试执行一个自定义的SQL重构(http://www.liquibase.org/manual/custom_sql)? – 2009-07-04 22:49:23

回答

15

由于liquibase作者提到here您需要在<sql>内添加CDATA部分。

在你的具体的例子,将成为:

<sql><![CDATA[ update table_something set table_content = " something <br/> in the next line " ]]></sql> 
4

即使最好不要使用在全部<sql>标签(我加where子句...):

<changeSet author="author" id="table_something_1"> 
    <update tableName="table_something"> 
     <column name="table_content"><![CDATA[ something <br/> in the next line ]]></column> 
     <where>id=1</where> 
    </update> 
    <rollback /> 
</changeSet>