#36438: makemigrations removes fields in wrong order when GeneratedFields are
involved
-------------------------------------+-------------------------------------
     Reporter:  Colton Saska         |                     Type:
                                     |  Cleanup/optimization
       Status:  new                  |                Component:  Database
                                     |  layer (models, ORM)
      Version:  5.2                  |                 Severity:  Normal
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
 Consider a model like PayItem with fields quantity, rate and total.

 When total is a GeneratedField dependent on quantity, if you remove
 quantity and total and generate migrations you get a migration like


 {{{
     operations = [
         migrations.RemoveField(
             model_name="payitem",
             name="total",
         ),
         migrations.RemoveField(
             model_name="payitem",
             name="quantity",
         ),
     ]
 }}}

 which will throw django.db.utils.OperationalError: (3108, "Column 'amount'
 has a generated column dependency.").

 It'd be nice if makemigrations listed operations in the correct order.
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36438>
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/010701973b979131-5d9bda03-ba0d-4079-945f-b82812a07c1d-000000%40eu-central-1.amazonses.com.

Reply via email to