Liquibase Changeset-如何为变更集使用替代唯一标识符? [英] Liquibase Changeset - How to use alternative unique identifier for a changeset?

查看:203
本文介绍了Liquibase Changeset-如何为变更集使用替代唯一标识符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在liquibase中,databasechangelog表中有3列,它们唯一地标识一个变更集并指示该变更集是否已执行.

in liquibase, there are 3 columns in the databasechangelog table, which uniquely identify a changeset and indicate if the changeset has been executed.

这些列是:

  • ID
  • 作者
  • FILENAME(更改日志文件路径)

当Liquibase执行databaseChangeLog时,它会按顺序读取changeSet,并针对每个变更集检查"databasechangelog"表,以查看id/author/filename的组合是否已运行.

As Liquibase executes the databaseChangeLog, it reads the changeSets in order and, for each one, checks the "databasechangelog" table to see if the combination of id/author/filename has been run.

我在自动部署的上下文中使用liquibase,因此更改集的文件路径不断变化.因此,相同的变更集将一遍又一遍地执行,这是不必要的行为.

I am using liquibase in the context of automated deployment, so the filepaths of my changesets change constantly. The same changeset therefore executes over and over again, which is unwanted behaviour.

是否有一种方法可以从组合中排除文件名,而文件名是变更集的唯一标识符?我基本上希望liquibase仅使用ID和Author.

Is there a way to exclude the filename from the combination that is the unique identifier of a changeset? I basically want liquibase to use ID and Author only.

谢谢

亲切的问候,

Tobias

推荐答案

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

I think all you need to do is edit the changelog so that it has the logicalFilePath attribute set. Here's an example:

<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属性.

It is also possible to set the logicalFilePath attribute on individual changesets if necessary.

与此相关的一些不错的论坛帖子: http://forum.liquibase.org/topic/i-need-to-ignore-the-filename-in-查看是否已应用更改的处理

Some good forum posts on this as well: http://forum.liquibase.org/topic/i-need-to-ignore-the-filename-in-the-processing-to-see-if-a-change-set-has-already-been-applied

这篇关于Liquibase Changeset-如何为变更集使用替代唯一标识符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆