Tuesday, March 22, 2022

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


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.


You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5821193.lOV4Wx5bFT%40delko.

No comments:

Post a Comment