Using Flyway to load data conditionally per environment

后端 未结 4 1694
感情败类
感情败类 2020-12-24 13:36

Does flyway support conditional execution of a script, per environment?

For example, if I have test data, can I create a test data script folder thats only loaded i

4条回答
  •  我在风中等你
    2020-12-24 14:17

    You can use flyway placeholder:

    Configure it on your enviroment config.properties:

    flyway.placeholders.tableName=MY_TABLE

    flyway.placeholders.name='Mr. Test'

    Then, put it on your script: INSERT INTO ${tableName} (name) VALUES (${name});

    I have used the flyway.locations too, but the placeholders is simpler than locations for simple changes.

提交回复
热议问题