Merging ChangeSets

Hi everyone,

I am facing the following requirement:

  1. Developer A adds a first ChangeSet with to add a column
  2. Later Developer B adds a second ChangeSet with to add another column to the same table
  3. Before pushing these changes to production, the DBA calls for merging these 2 changes in a single one because this ARTICLE table contains a large number of rows. As a result, this changes needs to be optimized.

How can we do that with Liquibase?

Using preconditions, I can do something to prevent ChangeSet 3 from running if ChangeSet 1 or 2 have already been applied. On the contrary, how could I prevent 1 and 2 from running (and let 3 run) when neither 1 nor 2 have been applied?

GĂ©rald

I developped a simplee piece of code which is able to handle this requirement.

  • First, I describe with a config file, that ChangeSet C is equivalent to ChangeSet A + ChangetSet B
  • Then, at runtime, prior to running Liquibase#update, I update the CHANGELOG table:
    • If A and B have been run, then I insert C as Executed to prevent it from being run
    • If A or B have been run, then I insert C as Executed and let A or B (the other one) run normally
    • If either A nor B have been run, then I insert A and B as Executed and let C run normally

I wonder whether this feature could find its way to Liquibase Core code?