#31335: Renaming a ForeignKey included in an index, and removing
UniqueConstraint,
Index with ForeignKey fails on MySQL.
-------------------------------------+-------------------------------------
Reporter: Stephen Finucane | Owner: Sergey
| Fursov
Type: Bug | Status: assigned
Component: Migrations | Version: 3.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by 777GE90):
I ran into this when upgrading Django from 1.X to 2.2.25, essentially we
had a historical migration that renamed a foreign key field that was
indexed. The newer version of Django seems to create a migration which
does `RemoveIndex` and `AddIndex`, which doesn't work since the index is
already renamed in the database and doesn't exist.
As a workaround I resolved it by modifying the old migration files so that
it does not seem like the field was ever renamed (i.e. update the original
files to include the latest name).
--
Ticket URL: <https://code.djangoproject.com/ticket/31335#comment:13>
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/068.c219e34334c5c06ca68a4ef5971cd92e%40djangoproject.com.