Rollback expected when MigrationUp throw an Exception #1954
Replies: 3 comments
-
|
Is the project dead? Or the dev(s) are very busy? Best regards |
Beta Was this translation helpful? Give feedback.
-
|
@jeremy-c87 no the project is not dead, sorry. I suggest you make a migration class per DDL statement |
Beta Was this translation helpful? Give feedback.
-
|
Ok, I understand. Best regards |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I am playing a bit with FluentMigrator. I use runner.MigrateUp() to apply modification in my db as explained in the documentation. When the migration code is correct everything works as expected but then I put an error in my SQL, for exemple a wrong column name in a ForeignKey constraint, The Exception is thrown and the migration is simply stopped. I expected a rollback of the current migration (class) at least but apparently not.
Is that expected? How should I write the migration so all the change MigrationUp has down is rolled back like in a transaction?
Thanks.
Best regards.
EDIT 1 :
I think I have undestood a part of the problem. In MariaDB (I use MySql5 as it is a fork), DDL statements create new transaction every statement so this cannot work.
But the question remain. How should I handle the case properly?
Beta Was this translation helpful? Give feedback.
All reactions