2009-07-04 67 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>