带有参数 toTag 的 Liquibase maven 更新命令

Liquibase maven update command with parameter toTag

我一直在尝试使用 liquibase maven 更新命令。

我的场景是这样的:

   1.  I have three versions of SQL in SVN.
   2.  I have already migrated to version 1.
   3.  Then I want to upgrade to version 2.
   4.  But don't want to apply version 3 migration.
   5.  With each version's changeset I use tagDatabase to tag database.

我经历了 maven 更新可选参数。我找到了一个可选参数 "toTag" 并尝试使用它。但结果是 toTag 参数没有按预期工作。 Liquibase 继续迁移版本 3。

我的maven配置如下:

<profile>
    <id>migrate-change-log</id>
    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.liquibase</groupId>
                <artifactId>liquibase-maven-plugin</artifactId>
                <version>${liquibase.version}</version>
                <configuration>
                    <propertyFile>liquibase.properties</propertyFile>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-resources</phase>
                        <configuration>
                            <verbose>${verbose}</verbose>
                            <toTag>${to.tag}</toTag>
                        </configuration>
                        <goals>
                            <goal>update</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</profile>

提前致谢。

为了不将特定变更集部署到给定环境,您需要指定一些内容来阻止部署该变更集。最常见的方法是使用上下文或标签。例如,您可能决定更改仅适用于开发或测试环境,因此您可以将属性 context="dev OR test" 放在该更改集上。然后在部署时在命令中指定上下文:即部署到开发环境时 context=dev,部署到生产环境时指定 context=prod.

标签旨在 'mark' 数据库,因为它具有与数据库一起使用的特定软件版本的所有更改,而不是作为控制部署哪些更改的方式。