我正在尝试组织我的变更集,以便每个文件都有一个变更集元素,如Liquibase 最佳实践,但是当我尝试对 Liquidbase xml 文件使用 validate 命令时,出现以下错误。
liquibase:cvc-elt.1:找不到元素的声明
'更改集'。 liquibase:作为 SAXException 抛出错误:解析错误
./1.xml 第 3 行第 38 列:cvc-elt.1:找不到以下声明
元素“changeSet”。
我究竟做错了什么?
master.xml:
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<include file="./1.xml"/>
<include file="./2.xml"/>
</databaseChangeLog>
1.xml:
<?xml version="1.0" encoding="utf-8" ?>
<changeSet id="1" author="me">
<createTable
tableName="CLIENTS"
...
</createTable>
</changeSet >
每个包含的文件都需要具有与标准变更日志相同的 XML 根节点 - 因此您的 1.xml 应如下所示:
<?xml version="1.0" encoding="utf-8" ?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<changeSet id="1" author="me">
<createTable
tableName="CLIENTS"
...
</createTable>
</changeSet >
您可能还需要在主变更日志中指定包含的文件与主变更日志相关。
...
<include file="1.xml" relativeToChangelogFile="true"/>
...
您是否需要这样做取决于您运行 liquibase 的方式。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)