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.
Duplicate of #25012.