id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 33709 Primary key of m2m tables is not migrated to BigAutoField Jeremy Lainé nobody "I am trying to upgrade an existing application's models to use only ""bigint"" primary keys on postgresql. To do this I changed DEFAULT_AUTO_FIELD to BigAutoField, generated the migrations then applied them. The tables for my explicitly defined models get upgraded correctly. The many-to-many intermediate tables on the other hand still have an ""integer"" primary key, with the 32bit limit I'm trying to avoid. The following model are sufficient to reproduce the issue: {{{ class Book(models.Model): name = models.CharField(max_length=255) tags = models.ManyToManyField(""Tag"") class Tag(models.Model): name = models.CharField(max_length=255) }}} The resulting schema for the testapp_book_tags looks like: {{{ test=> \d testapp_book_tags; Table ""public.testapp_book_tags"" Column | Type | Collation | Nullable | Default ---------+---------+-----------+----------+----------------------------------------------- id | integer | | not null | nextval('testapp_book_tags_id_seq'::regclass) book_id | bigint | | not null | tag_id | bigint | | not null | }}}" New feature closed Database layer (models, ORM) 3.2 Normal duplicate Unreviewed 0 0 0 0 0 0