我正在使用Liquibase 3.4.2 (通过Maven插件)。我有一个db.changelog-master.xml文件,其中包含另外两个文件:db.changelog-2.6.xml和db.changelog-2.10.
db.changelog-master.xml看起来如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog logicalFilePath="/database-migration/db.changelog-master.xml"
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-3.4.xsd">
<include file="versions/db.changelog-2.6.xml" relativeToChangelogFile="true"/>
<include file="versions/db.changelog-2.10.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>在db.changelog-2.10中,我创建了一个<changeSet>来删除一些数据,而在<rollback>标记中,我引用了创建相同数据的<changeSet>。这两个<changeSet>看起来如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog logicalFilePath="/database-migration/versions/db.changelog-2.10.xml"
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
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-3.4.xsd">
<changeSet id="1" author="my-user">
<insert tableName="TABLE">
<!-- SOME DATA -->
</insert>
</changeSet>
<changeSet id="2" author="my-user">
<delete tableName="TABLE" />
<rollback changeSetId="1" changeSetAuthor="my-user" />
</changeSet>
</databaseChangeLog>问题是,当我尝试运行update命令时,我最终得到了以下错误消息:
更改集/database-migration/versions/db.changelog-2.10.xml::1::my-user不存在
是我做错什么了还是这是个利基虫?
发布于 2016-09-29 10:18:38
请检查<changeSet id="1">中打开和关闭XML标记的匹配情况.在您的示例中,我看到了开始标记<insert>和结束标记</update>。可能您的问题是导致输入数据不正确。非常奇怪的是,清算库中的XML解析器没有检测到这一点。
尝试将结束标记</update>替换为更合适的</insert>。
发布于 2018-03-28 17:30:07
添加changeSetPath属性
change_log_master:... <include file="scripts/my_rollback_script.xml"/> <include file="scripts/the_script_change_log.xml"/> ...
the_script_change_log.xml:... <rollback changeSetId="my_rollback_script_id" changeSetAuthor="me" changeSetPath="scripts/my_rollback_script.xml" /> ...
https://stackoverflow.com/questions/37220025
复制相似问题