diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-01-27 18:51:39 +0100 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-01-27 18:52:35 +0100 |
| commit | 7c2d4d943b2905a8cfbb2d2f6c6fa15983b23ff1 (patch) | |
| tree | b3cff2afea69926c8b611e40987ff8c714b2ddb9 /django | |
| parent | f4de87038ef3adfe8c67ede6c3c5519451abe6cc (diff) | |
[4.0.x] Fixed #33462 -- Fixed migration crash when altering type of primary key with MTI and foreign key.
This prevents duplicated operations when altering type of primary key
with MTI and foreign key. Previously, a foreign key to the base model
was added twice, once directly and once by the inheritance model.
Thanks bcail for the report.
Regression in 325d7710ce9f6155bb55610ad6b4580d31263557.
Backport of e972620ada4f9ed7bc57f28e133e85c85b0a7b20 from main
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/backends/base/schema.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index 896ea3d517..da3ec1879d 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -30,7 +30,9 @@ def _is_relevant_relation(relation, altered_field): def _all_related_fields(model): - return model._meta._get_fields(forward=False, reverse=True, include_hidden=True) + return model._meta._get_fields( + forward=False, reverse=True, include_hidden=True, include_parents=False, + ) def _related_non_m2m_objects(old_field, new_field): |
