#29721: Migrations are not applied atomically
-----------------------------------------+------------------------
               Reporter:  Gavin Wahl     |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Migrations     |        Version:  2.1
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 Migrations run the migration and record that the migration was applied in
 a different transaction. This results in a broken/inconsistent database
 when an error or crash happens between those two steps. This is not purely
 theoretical, it has happened to me.

 The executor needs to call migration.apply and record_applied in the same
 transaction, and then the django_migrations table can't get out of sync
 with the migrations that have actually been applied. I think this could be
 done by moving the call to record_applied inside the schema_editor context
 manager block.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/29721>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.21890ac0f4eb964e21b8a47881f82a7a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to