Liquibase Changeset - 如何为变更集使用替代唯一标识符?

Liquibase Changeset - How to use alternative unique identifier for a changeset?

在liquibase中,databasechangelog中有3列table,它们唯一标识一个变更集,并指示变更集是否已经执行。

列是:

当 Liquibase 执行 databaseChangeLog 时,它会按顺序读取 changeSets,并为每个检查“databasechangelog”table 以查看 id/author/filename 的组合是否已 运行.

我在自动部署的上下文中使用 liquibase,所以我的变更集的文件路径不断变化。因此,同一个变更集会一遍又一遍地执行,这是不受欢迎的行为。

有没有办法从作为变更集唯一标识符的组合中排除文件名?我基本上希望 liquibase 仅使用 ID 和作者。

谢谢

亲切的问候,

托比亚斯

我认为您需要做的就是编辑变更日志,使其具有 logicalFilePath 属性集。这是一个例子:

<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.4.xsd"
                   logicalFilePath="changelog.xml">
    ...
</databaseChangeLog>

如有必要,也可以在单个变更集上设置 logicalFilePath 属性。

论坛上也有一些不错的帖子:http://forum.liquibase.org/topic/i-need-to-ignore-the-filename-in-the-processing-to-see-if-a-change-set-has-already-been-applied