[Django] #25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied

4 views
Skip to first unread message

Django

unread,
Aug 5, 2015, 9:04:11 PM8/5/15
to django-...@googlegroups.com
#25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied
-------------------------------+--------------------
Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------
I'm still seeing this behavior in 1.8.3 so I believe that this fix is
incomplete. The problem with the original fix is that it relies on the
{{{executor.migrate}}} method being called. While that is done by the
tests, it isn't when following the workflow described in the docs. When
you call the {{{migrate}}} management command, it first checks the
migration plan to see if any migrations need to be run. Since the
migration plan sees the replacement migration as already applied there is
no plan (assuming there are no other unapplied migrations) and the
{{{executor.migrate}}} is never called. In this case the replacement
migration is never recorded as applied. Then when the old migrations are
removed and the {{{replaces}}} attribute is removed, the {{{migrate}}}
command attempts to run the squashed migration which fails since the
tables, etc already exist.

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

Django

unread,
Aug 5, 2015, 9:16:19 PM8/5/15
to django-...@googlegroups.com
#25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied
-------------------------------+--------------------------------------

Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
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 mlavin):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

The easiest work-around is to use the {{{--fake-initial}}} option when
applying the squashed migration.

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

Django

unread,
Aug 6, 2015, 9:16:44 PM8/6/15
to django-...@googlegroups.com
#25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied
-------------------------------+--------------------------------------

Reporter: mlavin | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

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

* has_patch: 0 => 1


Comment:

Added PR with failing test https://github.com/django/django/pull/5112

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

Django

unread,
Aug 6, 2015, 10:01:24 PM8/6/15
to django-...@googlegroups.com
#25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied
----------------------------+---------------------------------------------
Reporter: mlavin | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | 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 charettes):

* cc: charettes (added)
* type: Uncategorized => Bug
* stage: Unreviewed => Ready for checkin


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

Django

unread,
Aug 7, 2015, 6:15:59 PM8/7/15
to django-...@googlegroups.com
#25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied
----------------------------+---------------------------------------------
Reporter: mlavin | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.8
Severity: Normal | 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 Tim Graham <timograham@…>):

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


Comment:

In [changeset:"69db1c745506bf63026def25d6854755179feaa8" 69db1c7]:
{{{
#!CommitTicketReference repository=""
revision="69db1c745506bf63026def25d6854755179feaa8"
Fixed #25231 -- Added recording of squashed migrations in the migrate
command.

Ensured squashed migrations are recorded as applied when the
migrate command is run and all of the original migrations
have been previously applied.
}}}

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

Django

unread,
Aug 7, 2015, 6:17:24 PM8/7/15
to django-...@googlegroups.com
#25231: Incomplete Fix for #24628 - Squashed Migration Still Not Marked as Applied
----------------------------+---------------------------------------------
Reporter: mlavin | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.8

Severity: Normal | 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 Tim Graham <timograham@…>):

In [changeset:"ac46eb7e8379e451d0acc1ace666fabd56d016ce" ac46eb7]:
{{{
#!CommitTicketReference repository=""
revision="ac46eb7e8379e451d0acc1ace666fabd56d016ce"
[1.8.x] Fixed #25231 -- Added recording of squashed migrations in the
migrate command.

Ensured squashed migrations are recorded as applied when the
migrate command is run and all of the original migrations
have been previously applied.

Backport of 69db1c745506bf63026def25d6854755179feaa8 from master
}}}

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

Reply all
Reply to author
Forward
0 new messages