#37060: AlterField doesn't propagate type changes through transitive
attname-based
to_field references
-------------------------------------+-------------------------------------
Reporter: Andrea Zanotto | Owner: Andrea
| Zanotto
Type: Bug | Status: closed
Component: Migrations | Version: 5.2
Severity: Normal | Resolution: fixed
Keywords: schema alterfield | Triage Stage: Ready for
to_field attname foreignkey | checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls <jacobtylerwalls@…>):
* resolution: => fixed
* status: assigned => closed
Comment:
In [changeset:"21c51c2623a966ba1ad8fd10e36bc8bbec93b70e" 21c51c2]:
{{{#!CommitTicketReference repository=""
revision="21c51c2623a966ba1ad8fd10e36bc8bbec93b70e"
Fixed #37060 -- Propagated AlterField through attname-based to_field
references.
Schema dependency discovery treated to_field values as raw field names, so
attname aliases such as "primary_id" were not matched to the underlying
relation field "primary". As a result, AlterField on a unique target field
updated direct dependencies but missed transitive attname-based
references.
Resolved the dependency matching by comparing resolved remote fields
rather than only field names, and updated SQLite's related-table rebuild
path to use the same recursive dependency discovery.
Added a regression test covering a transitive relation chain where
ForeignKey(..., to_field="primary_id") must widen along with the unique
leaf field it ultimately references.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/37060#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 visit
https://groups.google.com/d/msgid/django-updates/0107019e0251cdf8-24e5d32e-917b-426f-b556-559c8482b11b-000000%40eu-central-1.amazonses.com.