Home:ALL Converter>How to set flyway placeholders via micronaut application config?

How to set flyway placeholders via micronaut application config?

Ask Time:2019-05-09T20:30:34         Author:Miguel Ferreira

Json Formatter

I'm trying to run a migration script in a Micronaut app configured with Flyway integration. The app runs as expected and applies the migration scripts without any Flyway placeholders. However, whenever I add a Flyway placeholder to a migration script the application does not start anymore due to a FlywayException:

 org.flywaydb.core.api.FlywayException: No value provided for placeholder expressions: ${my_placeholder}.  Check your configuration!

I've tried to configure the placeholder in application.yml using the Micronaut Flyway placeholders configuration property (as described here https://micronaut-projects.github.io/micronaut-flyway/latest/guide/index.html#io.micronaut.configuration.dbmigration.flyway.FlywayConfigurationProperties) but the placeholder simply isn't picked up. The application.yml file looks like this:

flyway:
  datasources:
    default:
      locations: classpath:migrations
      placeholders:
        my_placeholder: "some value"

I've also tried creating a flyway.properties file with the placeholder defined according to what is described in this SO answer https://stackoverflow.com/a/9420671/2185719 but that did not work either

# flyway.properties
flyway.placeholders.my_placeholder=some value

Author:Miguel Ferreira,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/56059500/how-to-set-flyway-placeholders-via-micronaut-application-config
yy