Opened 3 months ago

Closed 3 months ago

#33734 closed Bug (needsinfo)

InconsistentMigrationHistory triggers on squashed migrations when not all replaced migrations are applied

Reported by: GwynBleidD Owned by: nobody
Component: Migrations Version: 3.2
Severity: Normal Keywords: migrations squash inconsistentmigrationhistory
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


#27004 fixed a bug with triggering InconsistentMigrationHistory in some cases but not all of them. For example in migration tree:

                /        \
    App A:    0001 ---> 0002
    App B:    0001

When only A.0001 and B.0002 are applied

I think 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.

Change History (2)

comment:1 Changed 3 months ago 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.)

comment:2 Changed 3 months ago by Mariusz Felisiak

Resolution: needsinfo
Status: newclosed

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

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