New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SQL migration script filename as a default placeholder #2914
Comments
Many thanks for the implementation. But if I use ${flyway:filename} in a callback script (for example beforeEachMigrate), I get the filename of the callback script. But what I need is the filename of the migration script also in the callback script (or the last migration script name in case of afterEachMigrate). Is it also possible to implement this? |
This isn't possible as each callback is only parsed, and therefore has its placeholders replaced, once. Parsing it again for each migration in order to identify and replace placeholders would be costly as the number of migrations goes up. It also doesn't feel like it should be a default placeholder for such a singular use case
This was intended, however it makes sense that a |
Thanks for the feedback and the description of the parsing problem. I may have a very special use case... - but the newly implemented placeholder will definitely help me a little bit. |
Which version and edition of Flyway are you using?
Flyway Community Edition 6.3.2
If this is not the latest version, can you reproduce the issue with the latest one as well?
(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
This is not a bug but a change request
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Command-line
Which database are you using (type & version)?
Oracle 18c
Which operating system are you using?
Flyway: Windows 10 / Oracle: Linux
What did you do?
(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
Is there a kind of default placeholder (like ${flyway:defaultSchema} or ${flyway:timestamp} for example) that is populated by flyway with the current sql migration script name before each migration run?
I want to use the file name with the help of a placeholder in a sql statement (for internal audit processes - the file name of a migration script contains, among other things, an internal ticket number) of a callback script (beforeMigrate or beforeEachMigrate) which, in order to be able to assign it (for internal audit processes), is placed within the same session as the actual migration script (which is the case with callback scripts, as far as I know).
Adjusting the sql migration script name manually in a custom placeholder inside the configfile (as a workaround) before each execution is quite cumbersome.
What did you expect to see?
As I learned with Stack Overflow, there is no such default placeholder. I would like to see this feature in a future flyway version.
What did you see instead?
This is not a bug but a change request
The text was updated successfully, but these errors were encountered: