Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#26647 closed Bug (fixed)

Post migrate signal old content type model

Reported by: Jasper Maes Owned by: Simon Charette
Component: Migrations Version: 1.10
Severity: Release blocker Keywords:
Cc: Simon Charette Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

I made a 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.

If someone can push me in the right direction I am willing to make a patch for this issue.

Change History (7)

comment:1 by Simon Charette, 8 years ago

Cc: Simon Charette added
Owner: changed from nobody to Simon Charette
Status: newassigned

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

comment:2 by Simon Charette, 8 years ago

Component: UncategorizedMigrations
Has patch: set
Needs tests: set
Patch needs improvement: set
Severity: NormalRelease blocker
Triage Stage: UnreviewedAccepted

It ended up being faster to write a fix by myself thanks to your test project, see PR.

Could you confirm it solves your reported issue?

comment:3 by Jasper Maes, 8 years ago

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

comment:4 by Simon Charette, 8 years ago

Needs tests: unset
Patch needs improvement: unset

Added tests.

comment:5 by Tim Graham, 8 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Simon Charette <charette.s@…>, 8 years ago

Resolution: fixed
Status: assignedclosed

In 36d3681:

Fixed #26647 -- Included the state of all applied migrations when migrating forward.

Thanks Jasper Maes for the detailed report.

comment:7 by Simon Charette <charette.s@…>, 8 years ago

In dfae72f:

[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

Note: See TracTickets for help on using tickets.
Back to Top