如何将特定变更集标记为在 liquibase maven 插件中应用?文档中没有任何相关内容,命令 markNextChangeSetRan 似乎什么也没做。
这个问题有一个“hacky”解决方案:
changeSet
XML 元素的所有子元素。请记住将 changeSet
及其 id 和作者参数保留在 liquibase XML 文件中。mvn liquibase:update
changeSet
。mvn liquibase:update
Validation Failed: 1 change sets check sum
新的金额。复制错误中的新校验和。
DATABASECHANGELOG
表中的右侧记录中。
sources ,似乎根本没有实现 markNextChangeSetRan
命令。所以我想,它根本不存在。
您可以在
liquibase JIRA 中添加票证来请求此操作,但似乎没有 Maven 插件的项目(但不知道 liquibase 的 Maven 插件是否在其他地方跟踪)。
抱歉没有更好的答案。我刚刚从
<changeSet author="bernd" id="1">
<preConditions onFail="MARK_RAN"><not><changeLogPropertyDefined property="should_be_ignored" value="true"/></not></preConditions>
...
</changeSet>
如果属性“should_be_ignored”设置为“true”,则此变更集将不会被执行,而是会在 DATABASECHANGELOG 表中标记为“MARK_RAN”。此外,您还可以在 liquibase 文件夹中创建一个额外的根
changeset.xml
文件,该文件定义此属性,并包含常规
changeset.xml
:
<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-3.8.xsd">
<!-- we only mark changesets with a pre-condition on this property as executed, but we do not execute them! !-->
<property name="should_be_ignored" value="true" />
<include file="changelog.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
然后您可以使用 changelog.xml
或使用此
changelog2.xml
启动应用程序,它将应用/不应用那些特定的变更集。