Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix 24424: migration autodetector won't remove last field on models being deleted #4487
Previously the migration auto-detector would produce transition states with invalid tables (for some backends) when removing models with only relation fields. The
In the case where the model being removed only has relation fields, this produces a state where there are no fields on the model, or a table without any columns. This breaks on SQLite (and MySQL, from what I gather).
This patch uses a simple field counter to make sure the last field on a model is not removed before the DeleteModel operation.
765dcc0 fixes the test