Opened 8 years ago

Last modified 8 years ago

#27422 closed Bug

`makemigrations` fails to migrate ForeignKey types across app boundaries — at Initial Version

Reported by: Andrew Badr Owned by: nobody
Component: Database layer (models, ORM) Version: 1.10
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 am using django-social-auth and a custom User model. I changed my User model to use a BigInteger id field. Everything looked ok, and I pushed into production, then started getting not-super-informative exceptions about integer out of range. I tracked it down to this bug—specifically, I had a django-social-auth model with a foreignkey to User—and was able to reproduce it using a clean Django project. This should either work correctly or raise an error.

Steps to reproduce:

  1. Create Model A
  2. Create Model B with a ForeignKey to Model A
  3. Alter the type of the ForeignKey on B, e.g. making it a BigInteger
  4. manage.py makemigrations and migrate

Expected behavior:
The type of the foreign-key column in the table for column B is changed to the new type.

Actual behavior:
The type of the foreign-key column in the table for column B is changed to the new type if and only if A and B are in the same app.

Change History (0)

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