Liquibase Changeset - How to use alternative uniqu

2019-09-14 21:03发布

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

The columns are:

  • ID
  • AUTHOR
  • FILENAME (the changelogs file path)

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.

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.

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.

Thank you

Kind regards,

Tobias

标签: liquibase
1条回答
你好瞎i
2楼-- · 2019-09-14 21:46

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>

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

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

查看更多
登录 后发表回答