#32674: DEFAULT_AUTO_FIELD changes should be detected for PKs of auto-created
intermediate M2M models.
-------------------------------------+-------------------------------------
Reporter: Cristiano Coelho | Owner: nobody
Type: New feature | Status: new
Component: Migrations | Version: 4.0
Severity: Normal | Resolution:
Keywords: DEFAULT_AUTO_FIELD | Triage Stage: Accepted
AutoField BigAutoField |
ManyToManyField |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Simon Charette):
> A project state used by migrations autodetector doesn't include auto-
created model, so the only fix that I can imagine would require including
through_pk_type in the ManyToManyField.deconstruct() but it's also tricky
and error-prone.
That seems like the only solution to me as well.
Having a `through_pk: Field(primary_key=True)` option instead of
`through_pk_type` seems more flexible though as it would allow easier
customization e.g. `though_pk=UUIDField(default=uuid.uuid4,
primary_key=True)`. I guess it could also serve as a way to define a
composite primary key on the `from_field` and `to_field` if we ever manage
to add support for that e.g. `through_pk=CompositePrimaryKey('author',
'book')`.
--
Ticket URL: <https://code.djangoproject.com/ticket/32674#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/070.d58b5193969ad7731f3c23b1a42c7469%40djangoproject.com.