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.

Reply via email to