[Django] #24902: Unapply separate migrations when squashed migrations exist

11 views
Skip to first unread message

Django

unread,
Jun 2, 2015, 8:11:43 PM6/2/15
to django-...@googlegroups.com
#24902: Unapply separate migrations when squashed migrations exist
--------------------------------------+------------------------
Reporter: MarkusH | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+------------------------
This is basically the inverse of #24628: separate migrations, that have
been applied, and at a later stage the squash has been marked as applied.
When you roll back before the squash the separate migrations won't be
marked as unapplied.

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

Django

unread,
Jun 3, 2015, 10:20:49 AM6/3/15
to django-...@googlegroups.com
#24902: Unapply separate migrations when squashed migrations exist
----------------------------+------------------------------------

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

* stage: Unreviewed => Accepted


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

Django

unread,
Jun 3, 2015, 3:36:51 PM6/3/15
to django-...@googlegroups.com
#24902: Unapply squashed migration when any of the individual migrations are
unapplied
----------------------------+------------------------------------

Reporter: MarkusH | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
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
----------------------------+------------------------------------

Old description:

> This is basically the inverse of #24628: separate migrations, that have
> been applied, and at a later stage the squash has been marked as applied.
> When you roll back before the squash the separate migrations won't be
> marked as unapplied.

New description:

This is basically the inverse of #24628: separate migrations, that have
been applied, and at a later stage the squash has been marked as applied.

When you roll back before the squash it won't be marked as unapplied.

--

Comment (by carljm):

Actually, look at the implementation of `apply_migration` and
`unapply_migration` - when a squash migration is applied or unapplied, it
marks only all the replaced migrations as applied or unapplied. So in the
case described here, the individual replaced migrations _will_ be marked
as unapplied, but the squash migration won't be.

In practice this doesn't really matter because the migration loader
automatically sets the 'applied' state of any squash migration based on
the applied state of all its replaced migrations. #24628 mattered only
because you might remove all the replaced migrations and remove the
'replaces' kwarg from the squash migration, and then it isn't a squash
migration anymore. You're only supposed to do that once everything is
applied everywhere.

That said, I don't see any harm in correctly maintaining the applied state
of the squash migration in the database in all cases; it does seem more
robust and may avoid future problems.

Updated title and description for accuracy.

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

Django

unread,
Jun 4, 2015, 3:11:30 AM6/4/15
to django-...@googlegroups.com
#24902: Unapply squashed migration when any of the individual migrations are
unapplied
----------------------------+------------------------------------
Reporter: MarkusH | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.8
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 MarkusH):

In that

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

Django

unread,
Jun 4, 2015, 3:12:55 AM6/4/15
to django-...@googlegroups.com
#24902: Unapply squashed migration when any of the individual migrations are
unapplied
----------------------------+------------------------------------
Reporter: MarkusH | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.8
Severity: Normal | Resolution: invalid
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 MarkusH):

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


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

Django

unread,
Jun 4, 2015, 12:33:03 PM6/4/15
to django-...@googlegroups.com
#24902: Unapply squashed migration when any of the individual migrations are
unapplied
----------------------------+------------------------------------
Reporter: MarkusH | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 1.8

Severity: Normal | Resolution: invalid
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 carljm):

That's fine, though I think we'll end up wanting to do this anyway if/when
#24900 is implemented.

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

Reply all
Reply to author
Forward
0 new messages