[Django] #33734: InconsistentMigrationHistory triggers on squashed migrations when not all replaced migrations are applied

12 views
Skip to first unread message

Django

unread,
May 23, 2022, 5:36:55 AM5/23/22
to django-...@googlegroups.com
#33734: InconsistentMigrationHistory triggers on squashed migrations when not all
replaced migrations are applied
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
GwynBleidD |
Type: Bug | Status: new
Component: | Version: 3.2
Migrations | Keywords: migrations squash
Severity: Normal | inconsistentmigrationhistory
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
#27004 fixed a bug with triggering `InconsistentMigrationHistory` in some
cases but not all of them. For example in migration tree:

{{{
0001_sq_0002
/ \
App A: 0001 ---> 0002
|
App B: 0001
}}}

When only A.0001 and B.0002 are applied

I think
[https://github.com/django/django/blob/main/django/db/migrations/loader.py#L320-L326
fix] applied in #27004 should check if any of migrations replaced are
already applied, not if all of them. When any of them is applied, we are
already on a separate path of applying migration and squash migration will
only be marked as applied, so it should be fine to change it from all to
any.

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

Django

unread,
May 23, 2022, 5:43:35 AM5/23/22
to django-...@googlegroups.com
#33734: InconsistentMigrationHistory triggers on squashed migrations when not all
replaced migrations are applied
-------------------------------------+-------------------------------------
Reporter: GwynBleidD | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 3.2
Severity: Normal | Resolution:
Keywords: migrations squash | Triage Stage:
inconsistentmigrationhistory | Unreviewed
Has patch: 0 | Needs documentation: 0

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

Comment (by Mariusz Felisiak):

Thanks for the report. Can you provide a sample project? Can you reproduce
`InconsistentMigrationHistory` in the Django 4.0, 4.1a1, and the current
`main` branch? (we made some improvements in this area.)

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

Django

unread,
May 23, 2022, 5:56:52 AM5/23/22
to django-...@googlegroups.com
#33734: InconsistentMigrationHistory triggers on squashed migrations when not all
replaced migrations are applied
-------------------------------------+-------------------------------------
Reporter: GwynBleidD | Owner: nobody
Type: Bug | Status: closed
Component: Migrations | Version: 3.2
Severity: Normal | Resolution: needsinfo

Keywords: migrations squash | Triage Stage:
inconsistentmigrationhistory | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

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


Comment:

I cannot reproduce any `InconsistentMigrationHistory` when only `A.0001`
and `B.0001` are applied (`B.0002` from the ticket description doesn't
exist.)

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

Reply all
Reply to author
Forward
0 new messages