Recreation of foreign key constraints when changing type of referenced primary key

16 views
Skip to first unread message

Gregor Jerše

unread,
Mar 22, 2022, 6:20:41 AM3/22/22
to django...@googlegroups.com
Hi,

I have a question regarding Django version 3.2.12.

When I change the DEFAULT_AUTO_FIELD to BigAutoField and create&apply
migrations, the foreign keys of auto-generated through tables are dropped.
This can be observed by running sqlmigrate which drops foreign key relations
but never recreates them.

I noticed this is already fixed in Django 4.0.3 (Refs #32743 -- Fixed
recreation of foreign key constraints when alter… · django/django@3d9040a ·
GitHub 1) but not in 3.2.x branch.

Can I expect this commit will in time be applied to Django 3.2.x branch? I
would like to migrate to BigAutoField to be future-proof, but would prefer not
to write migrations by hand.

Regards,
Gregor


Jason

unread,
Mar 22, 2022, 8:36:31 AM3/22/22
to Django users
You might want to ask this at https://groups.google.com/g/django-developers, as that is where the framework devs have their discussions.  This is more of a users group, and I think you'll get a faster answer by posting there.

Baraka Kiula

unread,
May 5, 2022, 12:54:25 PM5/5/22
to django...@googlegroups.com
i'm still a new here
Reply all
Reply to author
Forward
0 new messages