SQL Server USE statements within migration cause Flyway to fail #1676
Comments
Please provide the smallest possible SQL file that reproduces the issue. |
pk_issue.zip 1st file uses: 2 databases, it just creates tables. No insert. Do let me know your observation. |
Any update on this. |
We haven't had time to look into this and nobody else seems to be having the issue so far. You are of course welcome subscribe to one of our support plans and we would be happy to investigate immediately or alternatively you could roll up your sleeves and crack open the debugger to find out what is going on. |
I've run into this error also today. I "fixed" this problem temporarily by:
|
This is now fixed. Flyway now properly deals with migration scripts changing the current database. |
What version of Flyway are you using?
4.2.0 (flyway-commandline-4.2.0-windows-x64.zip)
Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin, SBT plugin, ANT tasks)
Command-line
What database are you using (type & version)?
SQL server 2012 (express edition)
What operating system are you using?
Windows 7 professional SP1
What did you do?
(Please include the content causing the issue, any relevant configuration settings, and the command you ran)
My scripts were running with flyway 4.0 command-line without issue.
Then I use flywayclean. And dropped DB. Created new DB. And then used flyway 4.2.0 with migrate.
But the same scripts failing when I am using 4.2.0 version even though there are no rows in that table.
What did you expect to see?
Should not raise Violation of PRIMARY KEY error, when there are no rows in that table.
What did you see instead?
SQL State : 23000
Error Code : 2627
Message : Violation of PRIMARY KEY constraint 'property_PRIMARY_property'. Cannot insert duplicate key in object 'dbo.property'.
The text was updated successfully, but these errors were encountered: