USE sql command leaks to subsequent migration files #1764
Closed
Milestone
Comments
Thanks for reporting. Fixed! |
Does the fix also isolate other side-effectful statements like |
It currently only ensures the current schema is reset correctly. Which statements specifically are impacting you? |
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
What version of Flyway are you using?
Flyway 4.2.0
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
Commandline
What database are you using (type & version)?
MySQL 5.7
What operating system are you using?
Linux
What did you do?
I have sql migration files. Inside one of them I wrote
USE db
. I then ranflyway migrate
.What did you expect to see?
I expected that each migration would be it's own independent transactional session. I did not expect that
USE db
in one SQL file would leak to affect other SQL files. This would mean possibly things likeSET
commands would also leak.What did you see instead?
The
USE db
caused all subsequent SQL files to fail due to running on the wrong database.The isolation of each sql file migration makes it easier to integrate generated sql files like from
mysql_tzinfo_to_sql
, which generates a sql file that needs to run against themysql
database. I had hoped that prependingUSE mysql;
would be good enough.The text was updated successfully, but these errors were encountered: