[Django] #26647: Post migrate signal old content type model

8 views
Skip to first unread message

Django

unread,
May 22, 2016, 4:57:55 PM5/22/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
-------------------------------+--------------------
Reporter: jlemaes | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 1.10
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
Since the post migrate signal has the apps argument and the
update_contenttypes and create_permissions listeners use this apps
argument to detect the ContentType model, there can be a bug when
unapplying a migration and then applying it again. The listeners will use
an old model with ContentType.name still present because this in the apps
of the state that the migration executor returned. [[BR]][[BR]]
I made a [https://github.com/jlemaes/django_post_migrate testproject] were
the error is replicated.
The tests for the first app will fail, but not for the second app. I
tracked this down to the migration executor were in the crashing app the
migrations are in front of the migration that removes the ContentType.name
field in the full_plan variable, so the executor returns a state not
including this ContentType model change.
[[BR]]
If someone can push me in the right direction I am willing to make a patch
for this issue.

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

Django

unread,
May 22, 2016, 5:51:13 PM5/22/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
-------------------------------+--------------------------------------
Reporter: jlemaes | Owner: charettes
Type: Bug | Status: assigned
Component: Uncategorized | Version: 1.10
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
-------------------------------+--------------------------------------
Changes (by charettes):

* status: new => assigned
* cc: charettes (added)
* needs_better_patch: => 0
* needs_tests: => 0
* owner: nobody => charettes
* needs_docs: => 0


Comment:

I'll have a look and try to point you in the right direction, thanks for
your report.

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

Django

unread,
May 22, 2016, 8:39:59 PM5/22/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
---------------------------------+-------------------------------------

Reporter: jlemaes | Owner: charettes
Type: Bug | Status: assigned
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Changes (by charettes):

* severity: Normal => Release blocker
* needs_better_patch: 0 => 1
* component: Uncategorized => Migrations
* needs_tests: 0 => 1
* has_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

It ended up being faster to write a fix by myself thanks to your test
project, see [https://github.com/django/django/pull/6642 PR].

Could you confirm it solves your reported issue?

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

Django

unread,
May 23, 2016, 1:28:08 AM5/23/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
---------------------------------+-------------------------------------
Reporter: jlemaes | Owner: charettes
Type: Bug | Status: assigned
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------

Comment (by jlemaes):

It indeed does fix the issue. Thanks for the quick fix.

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

Django

unread,
May 25, 2016, 2:34:19 AM5/25/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
---------------------------------+-------------------------------------
Reporter: jlemaes | Owner: charettes
Type: Bug | Status: assigned
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+-------------------------------------
Changes (by charettes):

* needs_better_patch: 1 => 0
* needs_tests: 1 => 0


Comment:

Added tests.

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

Django

unread,
May 26, 2016, 1:10:35 PM5/26/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
-------------------------------------+-------------------------------------

Reporter: jlemaes | Owner: charettes
Type: Bug | Status: assigned
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Ready for
| checkin

Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by timgraham):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/26647#comment:5>

Django

unread,
May 26, 2016, 1:31:43 PM5/26/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
-------------------------------------+-------------------------------------
Reporter: jlemaes | Owner: charettes
Type: Bug | Status: closed
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette <charette.s@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"36d36818a30025034cad6f1ee59b2a960a6582ec" 36d3681]:
{{{
#!CommitTicketReference repository=""
revision="36d36818a30025034cad6f1ee59b2a960a6582ec"
Fixed #26647 -- Included the state of all applied migrations when
migrating forward.

Thanks Jasper Maes for the detailed report.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26647#comment:6>

Django

unread,
May 26, 2016, 1:32:51 PM5/26/16
to django-...@googlegroups.com
#26647: Post migrate signal old content type model
-------------------------------------+-------------------------------------
Reporter: jlemaes | Owner: charettes
Type: Bug | Status: closed
Component: Migrations | Version: 1.10
Severity: Release blocker | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Simon Charette <charette.s@…>):

In [changeset:"dfae72f45a74b8fe3a08fe0a48c11bfeb9b9efda" dfae72f]:
{{{
#!CommitTicketReference repository=""
revision="dfae72f45a74b8fe3a08fe0a48c11bfeb9b9efda"
[1.10.x] Fixed #26647 -- Included the state of all applied migrations when
migrating forward.

Thanks Jasper Maes for the detailed report.

Backport of 36d36818a30025034cad6f1ee59b2a960a6582ec from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/26647#comment:7>

Reply all
Reply to author
Forward
0 new messages