| | 2 | |
| | 3 | I believe the most realistic and reliable reproducible reproducer is to add `import os; os.kill(os.getpid(), 9) # simulate an hard crash during migration recording.` to the first line of record_migration. A unrecoverable hard crash can happen at any time, that's why we have transactions. |
| | 4 | |
| | 5 | I've reproduced the issue with a deferred_sql migration and tested this fix |
| | 6 | Before: table created but migration not recorded. Migration "half applied" in inconsistent state. |
| | 7 | After: The whole transaction rolled back, tables not created and migration not recorded. Migration correct "not applied", consistent state. |