Skip to content
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

Mixed scripts above target trigger error when mixed=false #2392

facewindu opened this issue May 21, 2019 · 1 comment

Mixed scripts above target trigger error when mixed=false #2392

facewindu opened this issue May 21, 2019 · 1 comment


Copy link

@facewindu facewindu commented May 21, 2019

Which version and edition of Flyway are you using?

5.2.4 Community Edition

If this is not the latest version, can you reproduce the issue with the latest one as well?


Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Java API

Which database are you using (type & version)?

PG 11

Which operating system are you using?


What did you do?

I have mixed = false, meaning I cannot have transactional and non-transactional statements in the same migration script.
I have a unit test with 3 SQL migration scripts
V0: with transactional statements
V1: with non-transactional statements
V2: with mixed transactional and non-transactional statements

I have a unit test that tests that I can perform a migration from scratch to version 1, even if I have a 'pending' V2 script that would fail with mixed=false.
This test was working with Flyway 5.1.4, because when resolving the migrations, only the migration script path was considered at that point (in this code block)

In Flyway 5.2.4, a SqlScript object is created from all found migrations, and this fail when parsing the V2 script (see this and then this)

Basically, this check is done 'too soon', as all migrations scripts that are found are checked, even though some are 'pending', and this is ok to let them break the 'non-mixed' rule as long as they are not applied.

Is there a way for me to go back to the old behaviour, that allows to have scripts breaking the rule, as long as they are not applied when performing a migration ?

What did you expect to see?

I would have expected the same behaviour. Let the V2 script be, since it's not intended to be applied (target version = 1), and not fail.

What did you see instead?

Exception thrown due to V2 breaking the 'non-mixed statements' rule.

Copy link

@axelfontaine axelfontaine commented May 21, 2019

I can definitely see where you are coming from. We'll think about it for 6.0.


@axelfontaine axelfontaine added this to the Flyway 6.0.0 milestone May 21, 2019
@axelfontaine axelfontaine changed the title Cannot have scripts with mixed statements in a non-mixed statement configuration, even if said script is greater than specified target version Mixed scripts above target trigger error when mixed=false Jun 7, 2019
axelfontaine pushed a commit to flyway/ that referenced this issue Jun 7, 2019
dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants