Redgate Flyway

Tutorial - Configure migration conditional execution using placeholders

If you want to run migration related to feature A, for example, perform the following steps:

  1. Set the custom rule through the migration preview Deploy Rules:
  2. 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:

  1. 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


Didn't find what you were looking for?