Opened 9 years ago

Closed 9 years ago

#25366 closed Bug (duplicate)

Changing the type of a primary_key field in a migration does not update FK columns pointing to it

Reported by: Tino de Bruijn Owned by: nobody
Component: Migrations Version: 1.8
Severity: Normal Keywords:
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 ran into this when deciding to change from integers to uuid fields. Any fields pointing to the id of the changed model still had column type "integer" instead of "uuid" (on postgres). I hadn't read https://docs.djangoproject.com/en/1.8/howto/writing-migrations/#migrations-that-add-unique-fields, but figured out I needed to deal with the unique/non-null values, so I just wiped the table as it was in the early stage of development.

This probably needs documentation like the one mentioned above and a warning (like #23408) , because now both makemigrations and migrate run without any warnings or errors. But after that the structure is broken.

Change History (1)

comment:1 by Tim Graham, 9 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #25012.

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