Opened 3 years ago

Closed 3 years ago

#33488 closed Bug (duplicate)

Django rename migration does not rename the index

Reported by: Jef D Owned by: nobody
Component: Migrations Version: 4.0
Severity: Normal Keywords: migration, postgresql
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I tried to do a rename migration followed by a new field migration. This new field had the same name as the old field which was renamed.

The second migration failed on Postgres (not on SQLite). After an inspection it appears that the rename migration left the old index in place which made the new field migration fail.

Full details in this StackOverflow post: https://stackoverflow.com/questions/70970039/django-rename-field-and-create-new-one-with-the-same-name-returns-psycopg2-error/70971693#70971693

I don't know Django migrations well enough to judge if this is a Django issue or an psycopg issue. Since it occured in Django I will try this one first.

The current workaround is to manually drop or rename the old index.

Change History (1)

comment:1 by Simon Charette, 3 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #23577.

Note: See TracTickets for help on using tickets.
Back to Top