#35022: RenameIndex crashes when there is a unique index on the same fields.
-----------------------------------+------------------------------------
     Reporter:  Thomas Capricelli  |                    Owner:  nobody
         Type:  Bug                |                   Status:  new
    Component:  Migrations         |                  Version:  5.0
     Severity:  Normal             |               Resolution:
     Keywords:                     |             Triage Stage:  Accepted
    Has patch:  0                  |      Needs documentation:  0
  Needs tests:  0                  |  Patch needs improvement:  0
Easy pickings:  0                  |                    UI/UX:  0
-----------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

 * cc: David Wobrock (added)
 * stage:  Unreviewed => Accepted


Comment:

 Thanks for the report. The following patch fixes this for me:

 {{{#!diff
 diff --git a/django/db/migrations/operations/models.py
 b/django/db/migrations/operations/models.py
 index d616cafb45..204174f911 100644
 --- a/django/db/migrations/operations/models.py
 +++ b/django/db/migrations/operations/models.py
 @@ -1017,7 +1017,7 @@ 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(
 }}}

 Does it work for you?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/35022#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" 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-updates/0107018c428c845b-f80b3b81-fa75-4eaf-8957-9b830f232534-000000%40eu-central-1.amazonses.com.

Reply via email to