Tutorial - Configure migration conditional execution using placeholders
Published 22 September 2025
If you want to run migration related to feature A, for example, perform the following steps:
- Set the custom rule through the migration preview Deploy Rules:
- Set the placeholder value in e.g. the project .toml file:
featureA=true
Toggle this value so that if you want the migration script with the custom rule to run, it's set to true, but if you don't want it to run, set it too false.
If you want to run migration related to feature A, for example, perform the following steps:
- Set the custom rule using the shouldExecute expression in <migration>.sql.conf file:
shouldExecute=(${flyway:environment==dev)&&featureA==true
CI/CD Pipeline Placeholder Usage
If you want to set a placeholder value in your CI/CD pipeline, you can run migrations with the placeholder value set via the command line.
flyway -placeholders.featureA=true migrate
For more detail on placeholders see here: Placeholder Configuration