我正在尝试组织变更集,以使每个文件都有一个变更集元素(如Liquibase最佳实践所暗示),但是当我尝试在我的Liquidbase xml文件上使用validate命令时,出现以下错误。
liquibase:cvc-elt.1:找不到元素'changeSet'的声明。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。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句