#32674 (DEFAULT_AUTO_FIELD changes should be detected for PKs of auto-created intermediate M2M models.) – Django (original) (raw)

#32674 new New feature

Reported by: Owned by: nobody
Component: Migrations Version: 4.0
Severity: Normal Keywords: DEFAULT_AUTO_FIELD AutoField BigAutoField ManyToManyField
Cc: ccoelho@…, Tom Forbes, Simon Charette, Andrew Godwin, Shai Berger, Markus Holtermann, אורי, Ülgen Sarıkavak Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Django 3.2 introduced DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'. However, if we set it to BigAutoField, I would expect that the intermediary table created for ManyToMany relationships also honor this value.

Right now, we end up with tables that have FKs as bigint, but their own PK as integer. This may not be a direct bug, but will cause issues for sure.

Ideally, ManyToManyField should have an easy way to configure its PK without having to implement the through model.

Change History(9)

comment:1 by Mariusz Felisiak, 4 years ago

Cc: Tom Forbes added
Component: Uncategorized → Migrations
Easy pickings: unset
Severity: Normal → Release blocker
Summary: DEFAULT_AUTO_FIELD should also be used for ManyToMany table primary keys → DEFAULT_AUTO_FIELD changes should be detected for PKs of auto-created intermediate M2M models.
Triage Stage: Unreviewed → Accepted
Type: Uncategorized → Bug

Thanks for this report. I agree we should detect this change for PKs of auto-created intermediate models.

comment:2 by Mariusz Felisiak, 4 years ago

Cc: Simon Charette Andrew Godwin Shai Berger Markus Holtermann added
Severity: Release blocker → Normal
Type: Bug → New feature
Version: 3.2 → 4.0

comment:4 by Cristiano Coelho, 4 years ago

Can we at least provide more detailed migration steps? Right now, the only alternative is to go table by table and do the migration more or less manually. This is very time consuming for large projects.

Note: See TracTickets for help on using tickets.