【发布时间】:2018-12-30 08:55:38
【问题描述】:
问题
我最近将 Liquibase 从 3.4.2 升级到了 3.6.2。
现在将种子数据从 CSV 加载到文本字段会导致 CLOB 资源错误。在它只是将文本作为值插入之前。
设置
我正在使用 Liquibase 来管理我的数据迁移。
我有一个带有code 和description 列的表。 description 的类型为 TEXT。
<changeSet author="" id="create-table-degrees">
<createTable tableName="degrees">
<column name="code"
type="varchar(2)">
<constraints primaryKey="true"/>
</column>
<column name="description"
type="text">
<constraints unique="true"/>
</column>
</createTable>
<rollback>
<dropTable tableName="degrees"/>
</rollback>
</changeSet>
我在 CSV 中有种子数据:
code,description
"D1","MASTERS"
"D2","DOCTORATE"
我使用 loadData 加载它:
<changeSet author="" id="seed-degrees">
<loadData file="seeds/degrees.csv"
tableName="degrees" />
</changeSet>
错误
运行 Liquibase 时出现意外错误:找不到 CLOB 资源:MASTERS
问题
有没有办法阻止 Liquibase 将种子值解释为文件路径而不是字符串,还是我需要在 loadData 中手动将列类型定义为 String。
例如我想避免将旧的 changeSet 修改为:
<changeSet author="" id="seed-degrees">
<loadData file="seeds/degrees.csv"
tableName="roles">
<column name="description" type="string" />
</loadData>
</changeSet>
【问题讨论】:
-
请注意,我在 liquibase JIRA 中为此添加了一个问题 -- liquibase.jira.com/browse/CORE-3287