【问题标题】:liquibase include file and dbDoc Or update failsliquibase 包含文件和 dbDoc 或更新失败
【发布时间】:2013-01-19 05:05:18
【问题描述】:

我的迁移目录结构如下:

db1:

  • 最新/(触发器、函数、过程)
  • 桌子/
  • v000/master.xml
  • update.xml

db1/update.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">

    <include   file="v000/master.xml" relativeToChangelogFile="true"/>

</databaseChangeLog>

db2:(尝试在此处包含 db1/update.xml)架构,因为我需要扩展/添加到 db1 架构)

  • update.xml

db2/update.xml

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
         xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">


    <include   file="../db1/update.xml" />

</databaseChangeLog>

db1> liquibase --changeLogFile=update.xml 更新,成功

但是

db2 > liquibase --changeLogFile=update.xml 验证

显示 db1/v000/master.xml 中包含的表的验证错误

<include file="tables/12_createTable_audiences.xml" />

Error Reading Migration File:tables/12_createTable_audiences.xml .....

如果我通过以下更改修复错误(对于每个表:在 db1/v000/mater.xml 中)

 <include file="../tables/12_createTable_audiences.xml" relativeToChangelogFile="true"/>

db2 > liquibase --changeLogFile=update.xml 验证/更新工作正常

但是

db2 > liquibase --changeLogFile=update.xml dbDocs ~/docs/db1

表 12_createTable_audiences.xml 失败

有谁知道如何解决这些(路径问题)?为什么 update 和 dbDoc 命令对相同的路径表现不同?

感谢您的支持。

【问题讨论】:

  • 针对 liquibase 项目提出 JIRA 票

标签: migration database-migration liquibase


【解决方案1】:

不要使用relativeToChangelogFile 属性,而是尝试从根目录指定包含文件中的路径。类似的东西

<iuclude file = "./Update/db1/update.xml" />

【讨论】:

  • 我做了同样的事情,但其中一件事坏了。让我再试一次。
  • 尝试从根目录指定所有路径。
猜你喜欢
  • 2011-03-07
  • 1970-01-01
  • 2017-09-29
  • 1970-01-01
  • 2013-10-04
  • 1970-01-01
  • 1970-01-01
  • 2013-05-20
  • 1970-01-01
相关资源
最近更新 更多