Flyway Placeholders are not saved in the project

While using community edition desktop, I've noticed that once I did setup my placeholders, it does no save into the project file. So the next time I start the desktop, the placeholders are gone. 
Is this a bug or missing functionality that is being in development still?
Tagged:

Best Answers

  • Peter_LawsPeter_Laws Posts: 289 Silver 2
    As the interface says, these parameters are temporary and will not persist.
    Whereas, if you were to define them in the config file or environment variables (as mentioned in link of your first comment) they will then persist.

    Additionally, if you add them in either environment variables, or the root flyway install directory as opposed to the project directory, the placeholders will be available for all instances of flyway.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • Peter_LawsPeter_Laws Posts: 289 Silver 2
    Excellent!

    That degree of granularity is coming, you've probably seen the project configs starting to use TOML files, this has been instituted to allow environment specific definitions. It's still a work in progress however and will take a little time before what you're looking for is implemented exactly as you described.
    Hopefully the above format will be an adequate stopgap until then.

    If my replies have proven useful, please consider marking an applicable post as answered to assist other members of the community.
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?

Answers

  • Hi javaDuke,

    It could be either; how are you defining them and in what context please?
    Kind regards
    Peter Laws | Redgate Software
    Have you visited our Help Center?
  • javaDukejavaDuke Posts: 12 Bronze 1
    I'm defining for a migrate operation in the "flyway parameters" section

  • javaDukejavaDuke Posts: 12 Bronze 1
    Thank you for the insight! That can work  :)
    In a multi-env/team environment where one delivers the script and the other team applies to a different environments like (DEV, UAT, PROD, etc) is it possible to defile some sort of "profiles" that contain values for the placeholders specific to the target environment?
  • javaDukejavaDuke Posts: 12 Bronze 1
    As the interface says, these parameters are temporary and will not persist.
    Whereas, if you were to define them in the config file or environment variables (as mentioned in link of your first comment) they will then persist.

    Additionally, if you add them in either environment variables, or the root flyway install directory as opposed to the project directory, the placeholders will be available for all instances of flyway.
    It worked when I tried. Thank you!

    Just a note to other devs, there are two "toml" format config files:
    - flyway.toml
    - flyway.user.toml

    I tried setting up my placeholders in either of them and it worked.

    NOTE: When you setup in flyway.user.toml you should specify full placehalder key name otherwise it will not be found.

    Example:
    Consider placeholder key "myKey", then in flyway.user.toml you should specify:
    flyway.placeholders.myKey = "myValue"

    In flyway.toml there are sections and you can spectify in "Global" flyway section, e.g.
    [flyway]
    mixed = true
    outOfOrder = true
    locations = [ "filesystem:migrations" ]
    validateMigrationNaming = true
    placeholders.myKey = "myValue"

    Notice, that "flyway" prefix was omitted, since its part of the [flyway] section that adds this namespace.

    For environment specific section you have to specify full placeholder name, for example H2Mem:
    [environments.H2Mem]
    url = "jdbc:h2:mem:testdb"
    user = "sa"
    flyway.placeholders.myKey = "myValue" <-- notice prefix "flyway."

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file