I'm experiencing a weird behaviour migrating from Django 3.1.13 to 3.2.6.
With the following setup:
- Python 3.8.10
- PostgreSQL 11.12
- custom user model with `AutoField` pk
- model (also with `AutoField` pk) related to `User` via `ManyToManyField`
upgrading to Django 3.2.6 with `DEFAULT_AUTO_FIELD =
'django.db.models.BigAutoField'` leads to a DROP of the foreign key
constraints on the (implicit) through model.
The field types on the through model referencing the related models get
upgraded correctly; only FK constraints go missing.
I've setup a small reproducer at https://github.com/sanjioh/django32fk
Interested tables: `app_pet_owner` and Django owned ones involving the
`User` model (`app_user_groups` and `app_user_user_permissions`).
Please let me know if I can be of further help.
Fabio
--
Ticket URL: <https://code.djangoproject.com/ticket/33057>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => duplicate
Comment:
Duplicate of #32743 fixed in Django 4.0+, see
3d9040a50b160f8b4bb580e09f4120d4979fe29e.
--
Ticket URL: <https://code.djangoproject.com/ticket/33057#comment:1>
Comment (by Fabio Sangiovanni):
Hi Mariusz,
thanks, I somehow missed that searching for previous tickets about this
issue.
I see that the test in the PR detects the problem in case of model
inheritance, while my reproducer triggers it via a ManyToManyField
relation.
Do you think an additional test specifically targeting ManyToManyField
relations would add any value?
Fabio
--
Ticket URL: <https://code.djangoproject.com/ticket/33057#comment:2>
* keywords: => oracle
* status: closed => new
* resolution: duplicate =>
* stage: Unreviewed => Accepted
Comment:
> Do you think an additional test specifically targeting ManyToManyField
relations would add any value?
Yes it is. I noticed that it doesn't work on Oracle, see
[https://github.com/django/django/pull/14809 PR].
--
Ticket URL: <https://code.djangoproject.com/ticket/33057#comment:3>
* owner: nobody => Mariusz Felisiak
* status: new => assigned
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/33057#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/33057#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"1eb3f500a44b08a05868cd8bd85501dd6c7ee6c7" 1eb3f500]:
{{{
#!CommitTicketReference repository=""
revision="1eb3f500a44b08a05868cd8bd85501dd6c7ee6c7"
Fixed #33057 -- Fixed recreation of foreign key constraints in m2m tables
when altering type of referenced primary key on Oracle.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/33057#comment:6>