Did you try deleting this code and seeing if any test failed?

On Sat, 19 Sep 2020 at 17:54, Silvio <[email protected]> wrote:

> I've been digging around the 3.1 migration code just out of curiosity, and
> I stumbled upon this in autodetector.py#772:
>
>             for name in sorted(related_fields):
>                 self.add_operation(
>                     app_label,
>                     operations.RemoveField(
>                         model_name=model_name,
>                         name=name,
>                     )
>                 )
>
> It appears that all related fields for a model are removed before removing
> a model. This is great, *except*, optimizer.py will always strip these
> migrations out.
>
> That is: the RemoveField operations for related fields are always adjacent
> to the DeleteModel operation, so I cannot think of any case where
> optimizer.py will *not* strip these out.
>
> Am I missing something, or is this code that no longer contributes value?
> Perhaps the optimizer has gotten better since?
>
> Best,
>
> Silvio
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/46e53585-64f3-4e88-87a7-2cab7722aefan%40googlegroups.com
> <https://groups.google.com/d/msgid/django-developers/46e53585-64f3-4e88-87a7-2cab7722aefan%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Adam

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3Y9WD-8VR2hC93tu7BtgWrEr0j4nfOx9HSLbi0mm%3D50A%40mail.gmail.com.

Reply via email to