#31255: Migrations create a redundant RemoveField operation when deleting 2 
models
with related fields.
-------------------------------------+-------------------------------------
     Reporter:  Panagis              |                    Owner:  Rohit Jha
  Alisandratos                       |
         Type:                       |                   Status:  assigned
  Cleanup/optimization               |
    Component:  Migrations           |                  Version:  master
     Severity:  Normal               |               Resolution:
     Keywords:  migration,optimizer  |             Triage Stage:  Accepted
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by Sanskar Jaiswal):

 Upon going through some of the source code, the issue clearly arises
 because we are calling `RemoveField` in the `generate_deleted_models`
 method in `db/migrations/autodetector.py`
 
[https://github.com/django/django/blob/f283ffaa84ef0a558eb466b8fc3fae7e6fbb547c/django/db/migrations/autodetector.py#L707].
 I think calling this method here is redundant as `DeleteModel` should drop
 the table from the database which automatically deletes the related fields
 as well. Can someone confirm my hypothesis or correct me if I am steering
 in the wrong direction?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/31255#comment:5>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/066.8c8ec7e622d008970096e8e02580401a%40djangoproject.com.

Reply via email to