#31064: Migration doesn't detect precision changes in fields that ManyToMany
points
to.
-----------------------------+------------------------------------
Reporter: zapililirad | Owner: Dart
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+------------------------------------
Comment (by Sanskar Jaiswal):
Replying to [comment:4 Simon Charette]:
>
[https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/base/schema.py#L757
The re-pointing logic currently lives] in
`BaseDatabaseSchemaEditor._alter_field` but it's possible that it's only
[https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/sqlite3/schema.py#L348-L365
an issue with SQLite schema editor].
>
> By a quick glance at the code it looks like it could be a SQLite only
issue due to
[https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/sqlite3/schema.py#L364
this particular line].
After I did a bit of digging, it seems like
[https://github.com/django/django/blob/a4881f5e5d7ee38b7e83301331a0b4962845ef8a/django/db/backends/sqlite3/schema.py#L364
this particular line] was indeed the culprit. Instead of calling
`related_objects` on `new_field.model._meta`, if we call
`get_fields(forward=False, reverse=True, include_hidden=True)` on the
same, the `ForeignKey` in the `through` Model changes its type according
to the `ManyToManyField`.
--
Ticket URL: <https://code.djangoproject.com/ticket/31064#comment:5>
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/069.408aeb8fc0898882946a32a04fb0d8ed%40djangoproject.com.