[Django] #27737: Investigate if reloading old relational fields in migration operations' state_forwards is needed

14 views
Skip to first unread message

Django

unread,
Jan 16, 2017, 12:16:30 PM1/16/17
to django-...@googlegroups.com
#27737: Investigate if reloading old relational fields in migration operations'
state_forwards is needed
-------------------------------------+-------------------------------------
Reporter: Markus | Owner: Markus Holtermann
Holtermann |
Type: | Status: assigned
Cleanup/optimization |
Component: | Version: master
Migrations |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
As a followup to #27666

--
Ticket URL: <https://code.djangoproject.com/ticket/27737>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 16, 2017, 12:38:56 PM1/16/17
to django-...@googlegroups.com
#27737: Investigate if reloading old relational fields in migration operations'
state_forwards is needed
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Markus
Type: | Holtermann
Cleanup/optimization | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by Markus Holtermann:

Old description:

> As a followup to #27666

New description:

As a followup to #27666

The new behavior inside `state_forwards()` of migration operations is to
not reload related models of old relationships in the old state
(https://github.com/django/django/pull/7589/files#diff-
efb7d00c2383393046c9c5d842f45499R202). This might be just fine, but might
cause issues.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27737#comment:1>

Django

unread,
Jan 17, 2017, 8:15:45 AM1/17/17
to django-...@googlegroups.com
#27737: Investigate if reloading old relational fields in migration operations'
state_forwards is needed
-------------------------------------+-------------------------------------
Reporter: Markus Holtermann | Owner: Markus
Type: | Holtermann
Cleanup/optimization | 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
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/27737#comment:2>

Django

unread,
Mar 5, 2022, 6:22:14 AM3/5/22
to django-...@googlegroups.com
#27737: Investigate if reloading old relational fields in migration operations'
state_forwards is needed
--------------------------------------+------------------------------------
Reporter: Markus Holtermann | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: dev

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
--------------------------------------+------------------------------------
Changes (by Mariusz Felisiak):

* owner: Markus Holtermann => (none)
* status: assigned => new


--
Ticket URL: <https://code.djangoproject.com/ticket/27737#comment:3>

Django

unread,
Mar 30, 2026, 10:04:57 PM (11 days ago) Mar 30
to django-...@googlegroups.com
#27737: Investigate if reloading old relational fields in migration operations'
state_forwards is needed
--------------------------------------+------------------------------------
Reporter: Markus Holtermann | Owner: (none)
Type: Cleanup/optimization | Status: new
Component: Migrations | Version: dev
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
--------------------------------------+------------------------------------
Changes (by Suzannah Cooper):

* cc: Suzannah Cooper (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/27737#comment:4>

Django

unread,
8:40 AM (11 hours ago) 8:40 AM
to django-...@googlegroups.com
#27737: Investigate if reloading old relational fields in migration operations'
state_forwards is needed
--------------------------------------+------------------------------------
Reporter: Markus Holtermann | Owner: (none)
Type: Cleanup/optimization | Status: closed
Component: Migrations | Version: dev
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by Markus Holtermann):

* resolution: => wontfix
* status: new => closed

Comment:

After 9 years, I'm not entirely sure anymore, what I had in mind when I
opened this issue 9 years ago. The only reference to this ticket is in the
[https://github.com/django/django/blob/6f030e8e5d13ee94bf45d4322c17ca7c2d8aaffb/django/db/migrations/state.py#L298-L299
alter_field] method of the `ProjectState`.

Practically, the lack of reloading old models hasn't caused any problems
that could be attributed to this code here.

Logically, after the `alter_field` state operation, the previously
`new_state` becomes an `old_state` for the next operation. Which means,
the former `old_state` is unused. Thus no reloading is needed.
--
Ticket URL: <https://code.djangoproject.com/ticket/27737#comment:5>
Reply all
Reply to author
Forward
0 new messages