How do placeholders work in Flyway?

后端 未结 4 660
日久生厌
日久生厌 2020-12-09 11:00

I\'m evaluating Flyway for use in my project. Our current SQL scripts contain placeholders for things like URLs which will have a different domain names depending on the env

4条回答
  •  既然无缘
    2020-12-09 11:57

    If the token was subdomain:

    INSERT INTO FEED VALUES ('app.${subdomain}.company.org/feed1', 'My Feed');
    

    The values in flyway.conf:

    flyway.url=jdbc:mydb://db
    flyway.user=root
    flyway.schemas=schema1
    flyway.placeholders.subdomain=example
    

    Or command line:

    flyway -url=jdbc:mydb://db -user=root -schemas=schema1 -placeholders.subdomain=example migrate
    

    Would run the script as:

    INSERT INTO FEED VALUES ('app.example.company.org/feed1', 'My Feed');
    

提交回复
热议问题