Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Nested calls to routines containing non-tran operations don't get detected in mixed mode. #2546
Which version and edition of Flyway are you using?
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Which database are you using (type & version)?
Which operating system are you using?
What did you do?
Added new script sql\Migrations\V11.0__SomethingSomething.sql
What did you expect to see?
Flyway (if it were able to traverse nested calls) would detect that in Mixed mode that V script should be marked as [non-transactional].
What did you see instead?
V script was not marked as [non-transactional], and it errors out because sp_addarticle is not allowed to be called within TRAN wrapper that Flyway creates.
I realize this is a very complex problem, and it will probably take you quite some hoop jumping to resolve. As a temporary workaround we fake inject a NON-TRAN operation into the V script just to get things to run. Not ideal - unless you have a better idea for us.
This is related to #2478.
As you suggested, this is a very complex problem full of edge cases, so we intend to provide a mechanism to force a script [not] to run within a transaction. We haven't settled on anything specific, but it's likely to involve adding a comment to the top of the script, for example:
-- flyway transactional: true
@alextercete Let me make sure I understand your/new approach right, for every V script that I want executed in this mode, one has to make a conf file, with the same name ? and in the usual conf folder ? and Flyway will automatically know to use that conf ? .... and now the possible deal breaker: What if it is one of the callback scripts that currently explodes in my collection ? (do i just make a conf file with the matching callback script name ?)
@seb-urbaniak That's very close to how it's been implemented, except that
As the example suggests, this approach would work for callbacks as well: just create a