#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.