Kshitiz Sharma Kshitiz Sharma - 1 year ago 181
Java Question

Liquibase: How to identify change set only basis ID?

As per the liquibase documentation:

Each changeSet tag is uniquely identified by the combination of the
“id” tag, the “author” tag, and the changelog file classpath name.

This seems to be a very poor design choice. The identity of a changeset shouldn't be linked to its location. If the changelog is run via automatic application deployment the changeset would come from a classpath location within a JAR file. If I want to run the same changesets from commandline manually, the location might be the current directory.

In this case instead of recognizing the changeset as same based on its ID liquibase will try to apply it twice. Is there a way to change this behavior and have it identify changesets only basis specified ID?

Answer Source

I would suggest using the logicalFilePath attribute of databaseChangeLog tag.

This gives you more freedom to change the directory structure of your project. Also it prevents the file name from being stored as an absolute path (which might happen in some circumstances).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download