'liquibase mark changeset applied

How is it possible to mark specific changeset as applied in liquibase maven plugin? There's nothing about that in documentation, the command markNextChangeSetRan seems to do nothing.



Solution 1:[1]

Looking at the sources in the current master branch (which is currently 3.0.0-beta2-SNAPSHOT) it seems that there simply is no implementation of the markNextChangeSetRan command.

So I guess, it's simply not there.

You could add a ticket to request this in the liquibase JIRA but there seems to be no project for the maven plugin (don't know though if the maven plugin for liquibase is tracked elsewhere).

Sorry to have no better answer. I just checked out the complete liquibase code from github myself to implement a missing feature and so I thought I just quickly check this.

Solution 2:[2]

There is a "hacky" solution for this problem:

  1. Delete all the children of the problematic changeSet XML element. Remember to leave the changeSet with its id and author parameters in the liquibase XML file.
  2. Run mvn liquibase:update
    • It should say it ran the required specific changeSet.
  3. Revert the XML file that you modified.
  4. Run mvn liquibase:update again
    • You will get Validation Failed: 1 change sets check sum with the new sum. Copy that new check sum from the error.
  5. Paste the check sum manually into the right record in the DATABASECHANGELOG table of the target database.

Solution 3:[3]

You can run mvn liquibase:changelogSyncSQL to generate a set of SQL statements that will mark your changesets as applied.

It will put the queries in target/liquibase/migrate.sql. You can then manually execute these SQL statements in your DB.

https://b-gyula.github.io/liquibase-doc/documentation/existing_project

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jens
Solution 2
Solution 3 johan.blumenberg