Liquibase for Multiple DB Schemas (with different changelogs)

Hello all,
I was just wondering whether it is possible to use Liquibase to manage more than one DB Schema

The use case is that we have an application that has several different DB Schemas under one DB Server, with each one having a different set of tables. So something like so:

MySQL:

     DB Schema 1:
          Table A, Table B
     DB Schema 2:
          Table C, Table D
     DB Schema 3:
          Table E, Table F

There is no foreign key constraint between any table, each DB Schema is its own independent thing.
We’d like to integrate liquibase and use it to manage all three schemas, is it possible?

Thanks

1 Like

Hi @or.keren21

By “use Liquibase to manage more than one DB Schema”, do you mean having everything in the same changelogs (same files) and depending on the target schema, deploy either this table or other one?
If this is the case, then yes, it can be done, using a functionality called “contexts”.
Check out contexts and how you can conditionally apply particular changesets (in the current example, createTable type of changeset) on different target environments (DBSchema1…n)) depending on this input context value: Understanding When to Use Contexts vs. Labels | Liquibase
and context tag | Liquibase Docs