Does liquibase support reusable changeset or changeset inheritance?

Hello,

I am wondering if there is a way to reuse changeset. Please let me describe my issue. I have a baseline changeset that defines the core set of changes. I also have other change sets that enhance the baseline changes. Adding some extra steps to the changes. At this time, I am duplicating the core changes to different changelogs. Something like below

Let’s assume changelog1 and changelog2 are used for different RDBMS. I put the RDBMS specific change to those special changes

changelog1:
      changeset:
          core change 1
          core change 2 
           special change for changelog1

changelog2:
      changeset:
          core change 1
          core change 2 
           special change for changelog2

As we can see from above core change 1 and core change 2 are configured in both changelog1 and changelog2. Yes, I am using changefile reference. So I do not really duplicate the content. But I still need to configure the changesets separately. I would like to manage the core changes in a central place then all of the changelogs will get a consistent view.

I am wondering if it is possible to do something like below or equivalent.

corechange:
   changeset:
          core change 1
          core change 2 
         

changelog1:
      changeset:
           reference to corechange
           special change for changelog1

changelog2:
      changeset:
           reference to corechange
           special change for changelog2

corechange can be something like abstract class which cannot be deployed directly. With something like this, I will have a central place to control the core change set.

Is there any way I can do this?

Thanks

Lin

What happens when you try to do it? Is there an error message that comes up?

I have not figured out how to do it in the idea way yet. Looking for some adviice from experts.

check out some of the nested changelog info here Working with Changelogs | Liquibase Docs – that might help

Also, highly recommend the Managing Liquibase Changelogs course here Managing Liquibase Changelogs (LB203) if you haven’t already tried that out

1 Like

Thanks for the guidance.

2 Likes