[Django] #30039: Inconsistency error after unapplying squash migration.

14 views
Skip to first unread message

Django

unread,
Dec 13, 2018, 2:19:52 AM12/13/18
to django-...@googlegroups.com
#30039: Inconsistency error after unapplying squash migration.
-------------------------------------+-------------------------------------
Reporter: Shehzad- | Owner: nobody
Ahmed |
Type: Bug | Status: new
Component: Database | Version: 2.1
layer (models, ORM) | Keywords: Squash migration,
Severity: Normal | replaces, rolled back(UN-applied)
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Just for reminder: Migrations contain parent migrations called
dependencies. So when an parent migration is rolled back all of its
successors are also rolled back. For the consistency django make record of
all applied and rolled back(unapplied) migrations. Now before any new
migration is applied consistency is checked.

Just for reminder: In Case when a squash migration is created, a list
inside it is maintained which tracks all migrations it replaced called
replaces.

Problem: when a squash migration is rolled back all its replaces(which can
be dependencies or depended on other migrations) are marked UN-applied but
squash migration migration it-self does not record UN-applied. Since the
operation of rolling back squash migration becomes completed. But Then
when new migrate operation is performed, it causes inconsistency error e.g
below:

"django.db.migrations.exceptions.InconsistentMigrationHistory: Migration
compliance.0007_auto_20180329_1238_squashed_0026_auto_20180815_0741 is
applied before its dependency
survey.0092_prospectfarmerviewlinkcompliancelink on database 'default' ."

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

Django

unread,
Dec 13, 2018, 3:32:54 AM12/13/18
to django-...@googlegroups.com
#30039: Inconsistency error after unapplying squash migration.
-------------------------------------+-------------------------------------
Reporter: Shehzad-Ahmed | Owner: nobody
Type: Bug | Status: new
Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Squash migration, | Triage Stage:
replaces, rolled back(UN-applied) | Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson):

Hi. Thanks for the report. Are you able to put together a small sample
project demonstrating this?

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

Django

unread,
Dec 13, 2018, 8:38:43 AM12/13/18
to django-...@googlegroups.com
#30039: Inconsistency error after unapplying squash migration.
-------------------------------------+-------------------------------------
Reporter: Shehzad-Ahmed | Owner: nobody
Type: Bug | Status: new

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Squash migration, | Triage Stage:
replaces, rolled back(UN-applied) | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

* needs_tests: 0 => 1


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

Django

unread,
Dec 13, 2018, 8:39:25 AM12/13/18
to django-...@googlegroups.com
#30039: Inconsistency error after unapplying squash migration.
-------------------------------------+-------------------------------------
Reporter: Shehzad-Ahmed | Owner: nobody
Type: Bug | Status: new

Component: Database layer | Version: 2.1
(models, ORM) |
Severity: Normal | Resolution:
Keywords: Squash migration, | Triage Stage:
replaces, rolled back(UN-applied) | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

Comment (by Simon Charette):

Or at least tests to demonstrate the issue.

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

Django

unread,
Dec 20, 2018, 10:45:08 AM12/20/18
to django-...@googlegroups.com
#30039: Inconsistency error after unapplying squash migration.
-------------------------------------+-------------------------------------
Reporter: Shehzad-Ahmed | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 2.1
Severity: Normal | Resolution:
| worksforme

Keywords: Squash migration, | Triage Stage:
replaces, rolled back(UN-applied) | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

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

* status: new => closed
* resolution: => worksforme
* component: Database layer (models, ORM) => Migrations


Comment:

OK, I can't reproduce this with the information provided.

In my testing all combinations of `migrate`, `showmigrations`,
`squashmigrations` and so on are behaving as expected.

Happy to look at a sample project demonstrating an issue, but short of
that I'm not sure we can say anything.

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

Reply all
Reply to author
Forward
0 new messages