You can use the contexts
and labels
attributes available to changesets and commands to accomplish what you want.
This Liquibase blog post goes into detail. Here is a quote from that article describing Contexts:
Contexts in Liquibase have been available for quite a while, and they
started out primarily as a way of “tagging” changeSets so they can be
chosen at runtime. One common use is to mark changeSets that insert
test data as context=”test” so that in your development and QA
environments you you can run liquibase with –contexts=test to get the
test data and in production you run with –contexts=prod to not have
test data. Contexts are also helpful for marking changeSets based on
feature sets to include (context=”shoppingCart”) or bundle
(context=”pro”) or even customer (context=”acme_inc”). For complex
cases, multiple contexts can be applied to a changeSet such as
context=”acme_inc, pro” and multiple contexts can be chosen at runtime
such as –contexts=free,qa.
With Liquibase 3.2, support was added to for context expressions in
changeSets. Now, when you are defining your changeSet you can specify
complex logic such as context=”!test” or context=”qa or (acme_inc and
dev)”. The context logic can only be specified in your changeSet
definition, however. When running Liquibase, you can still specify
multiple contexts, but you are just listing out all the contexts that
apply to the current Liquibase run.