-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
Transactional migrations are applied partially if fail in the middle #217
Comments
Are you using the latest alpha? There are tests that check fired queries, the transaction is definitely there. |
In the lock |
Seems the problem cause is |
Then please try latest, should be 32. Allornothing was not implemented in 31 afaik. Here is snapshot from latest tests: https://github.com/mikro-orm/mikro-orm/blob/dev/tests/__snapshots__/Migrator.test.ts.snap#L85 |
I will re-check, but anyway seems MySQL 5.7 i use can't rollback DDL changes at all. In 8.0 there can be some enhancements. |
Right, didn't know about that, apparently there is no way to rollback DDL changes so they are forcing implicit commit and running DDL statements in dedicated transactions (one per query). I guess there is nothing we can do about it, will add a note to migrations docs at least. Here is docs about it: https://dev.mysql.com/doc/refman/5.7/en/implicit-commit.html (8.0 docs states the same: https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html) |
Added a note to the migrations docs. |
@B4nan I just stumbled over this, it seems MariaDB suffers from the same issue: https://mariadb.com/kb/en/start-transaction/#ddl-statements It may be worth adding that to the docs as well. (Haven't tried it, just read the page). |
Describe the bug
I have the following mikro-orm.config.ts
I don't override isTransactional in migration classes
I noticed on debugging migrations that if i have an error in some statement in the middle of migration previous statements are still applied to the database. All It indicates that there is no migration transaction and master transaction too.
The text was updated successfully, but these errors were encountered: