Changes between Initial Version and Version 1 of Ticket #31416, comment 6
- Timestamp:
- Apr 5, 2020, 4:16:07 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31416, comment 6
initial v1 3 3 I think the best approach would be to adjust `check_dependency` to account for this case. What's happening now is that created models detection runs before removed models one so while both operations depend on `Readable` model. It's possible that `generate_created_models` might need to be adjusted to add a dependency on field removal of all of its base to make sure the order is swapped. I think the correct dependency representation is `(base_app_label, base_model_name, field_name, False)` for all fields in all bases in https://github.com/django/django/blob/6fbce45b0376f0ec8f3bf244f4f1f8d62c201f58/django/db/migrations/autodetector.py#L561-L565. 4 4 5 Something the solution has to consider is when a field is removed from a base while two subclasses are added in the same run with this field (e.g. an extra `class Magazine(Readable): title = models.CharField(max_length=200)` would be added to the reporter's example). In this case a single `RemoveField` must be generated 5 Something the solution has to consider is when a field is removed from a base while two subclasses are added in the same run with this field (e.g. an extra `class Magazine(Readable): title = models.CharField(max_length=200)` would be added to the reporter's example). In this case a single `RemoveField` must be generated and not multiple ones.