Placeholders variables names
superdede88
Posts: 3 New member
Hello,
When calling CLI, I usually use placeholders variable names with dots like
-placeholders.language.description="something"
but I feel like it doesn't work anymore with the latest version (10.17), Am I right ?
I get
ERROR: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
It works fine with versions 8 and 9.
Thanks
Tagged:
Answers
Hi @superdede88
Thanks for reaching out on the Redgate forums regarding your Flyway query.
The placeholders should certainly still work with dots.
https://documentation.red-gate.com/flyway/flyway-cli-and-api/configuration/parameters/flyway/placeholders
The error you have provided does sometimes occur when a string is not recognized. I wonder if there is perhaps some sort of depreciation or change in variable usage that has occurred between V 8/9 & 10.
Are you able to share your Flyway command string including placeholders, scrubbing any personal data. I can help to check to see if there are any items that may have changed between V10 & previous versions.
Flyway Community Edition 10.17.2 by Redgate
Flyway permit on disk is expired and cannot be refreshed automatically because there is no refresh token on disk. Please rerun auth
No Flyway license detected for this user - using Community Edition. If you expected a Teams/Enterprise license then please add a Flyway license to your account and rerun auth. Alternatively, you can run auth -logout to remove your unlicensed permit on disk
See release notes here: https://rd.gt/416ObMi
Database: jdbc:postgresql://localhost:5432/lexsys (PostgreSQL 15.2)
Successfully validated 7 migrations (execution time 00:00.036s)
ERROR: Unable to parse command line params.
ERROR: Unable to parse command line params.
ERROR: java.lang.ClassCastException: class java.lang.String cannot be cast to class java.util.Map (java.lang.String and java.util.Map are in module java.base of loader 'bootstrap')
WARNING: This version of Flyway is out of date. Upgrade to Flyway 10.17.2: https://rd.gt/3rXiSlV
Flyway Community Edition 9.22.3 by Redgate
See release notes here: https://rd.gt/416ObMi
Database: jdbc:postgresql://localhost:5432/lexsys (PostgreSQL 15.2)
Successfully validated 7 migrations (execution time 00:00.027s)
WARNING: This version of Flyway is out of date. Upgrade to Flyway 10.17.2: https://rd.gt/3rXiSlV
Flyway Community Edition 9.22.3 by Redgate
See release notes here: https://rd.gt/416ObMi
Database: jdbc:postgresql://localhost:5432/lexsys (PostgreSQL 15.2)
Successfully validated 7 migrations (execution time 00:00.026s)
WARNING: This version of Flyway is out of date. Upgrade to Flyway 10.17.2: https://rd.gt/3rXiSlV
Flyway Community Edition 9.22.3 by Redgate
See release notes here: https://rd.gt/416ObMi
Database: jdbc:postgresql://localhost:5432/lexsys (PostgreSQL 15.2)
Successfully validated 7 migrations (execution time 00:00.023s)
WARNING: This version of Flyway is out of date. Upgrade to Flyway 10.17.2: https://rd.gt/3rXiSlV
Flyway Community Edition 9.22.3 by Redgate
See release notes here: https://rd.gt/416ObMi
Database: jdbc:postgresql://localhost:5432/lexsys (PostgreSQL 15.2)
Successfully validated 7 migrations (execution time 00:00.022s)
One thought on a change that occurred in V10 is the movement from *.conf to *.toml for the Flyway configuration file.
This may lead to this issue as Flyway V10+ may not be able to reference your placeholders such as $HOME.
I refer this page for a guide on the V10 release and change to *.conf files.
https://documentation.red-gate.com/fd/flyway-v10-has-landed-222627771.html
Can you verify if you are using a conf or toml file in your project?
---
An upgrade to the Flyway.conf file with support for "environments"
A new configuration format will replace the flyway.conf.
TOML is a similar format (key-value pairs) as the conf file although it allows us to more easily structure the data stored within it. The reason for introducing this change is that it has allowed us to create a shared configuration file between Flyway CLI and Flyway Desktop. An added benefit to this has been that there are many cases where you have to work with multiple DBs (for example, dev and test environments) and Flyway didn't have a convenient way to represent these. We are now introducing the concept of environments where this represents what you need to configure to work with a particular environment. More details regarding the environment settings can be found here.
For a period both the .conf and .toml formats will work, but new features we only be added to the new toml configuration format.