migrate icon indicating copy to clipboard operation
migrate copied to clipboard

Explicit transaction not rolled back on failure - mysql

Open cycloss opened this issue 3 years ago • 0 comments

Describe the Bug I'm using migrate with the mysql driver, and I have three pairs of migrate files. Each of the files, I start with a BEGIN;, and end with COMMIT;, with multiple statements in between. To my surprise, if a migration fails half way through having run a number of statements, those statements are not rolled back and remain in the database.

I find this very surprising behaviour given that the docs recommend wrapping everything in a begin and commit. It makes a complete mess of the database which I then have to go in and fix, then force the version, then try again. If it respected the transaction, I would be able to just fix the migration file and then run it again. Am I missing something here?

I would expect the migration to stop at the file that caused the error, and roll back the changes made in that file.

Migrate Version 4.15.2

cycloss avatar Jun 09 '22 17:06 cycloss