diff options
| author | David Wobrock <david.wobrock@gmail.com> | 2022-05-16 09:57:49 +0200 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-05-16 10:36:56 +0200 |
| commit | 11310e9abbdd784aea4ba50451144fc9c239f71f (patch) | |
| tree | 5034f1ec9eb9f1d44a58f1f1707424f9bbc3ba65 /django | |
| parent | 647480166bfe7532e8c471fef0146e3a17e6c0c9 (diff) | |
Fixed #33710 -- Made RenameIndex operation a noop when the old and new name match.
Diffstat (limited to 'django')
| -rw-r--r-- | django/db/migrations/operations/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py index d17232e4ec..75a3b8b030 100644 --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -960,6 +960,9 @@ class RenameIndex(IndexOperation): else: from_model_state = from_state.models[app_label, self.model_name_lower] old_index = from_model_state.get_index_by_name(self.old_name) + # Don't alter when the index name is not changed. + if old_index.name == self.new_name: + return to_model_state = to_state.models[app_label, self.model_name_lower] new_index = to_model_state.get_index_by_name(self.new_name) |
