1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #35022 -- Fixed RenameIndex() crash on unnamed indexes if exists unique constraint on the same fields.

This commit is contained in:
David Wobrock
2023-12-22 09:49:56 +01:00
committed by Mariusz Felisiak
parent 6c08dba517
commit 7045661069
2 changed files with 24 additions and 1 deletions

View File

@@ -1017,7 +1017,10 @@ class RenameIndex(IndexOperation):
from_model._meta.get_field(field).column for field in self.old_fields
]
matching_index_name = schema_editor._constraint_names(
from_model, column_names=columns, index=True
from_model,
column_names=columns,
index=True,
unique=False,
)
if len(matching_index_name) != 1:
raise ValueError(