#36141: After double squashing migrate command fails with
InconsistentMigrationHistory
-----------------------------+-------------------------------------------
Reporter: Jacob Walls | Type: Bug
Status: new | Component: Migrations
Version: dev | Severity: Release blocker
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+-------------------------------------------
[main/6.0]
Make four migrations, migrate, squash the first two, then squash the first
three: then migrate (or makemigrations --check) fails.
{{{#!shell
manage.py makemigrations myapp --empty
manage.py makemigrations myapp --empty
manage.py makemigrations myapp --empty
manage.py makemigrations myapp --empty
manage.py migrate
manage.py squashmigrations myapp 0001 0002
manage.py squashmigrations myapp 0001_initial_squashed 0003
manage.py migrate
}}}
{{{
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration
myapp.0004_auto_20250126_1339 is applied before its dependency
new.0001_initial_squashed_0002_auto_20250126_1339_squashed_0003_auto_20250126_1339
on database 'default'.
}}}
Other migration commands can be subbed for that last call and still
produce the same error, e.g. `makemigrations --check`, which is likely in
a CI setting.
--
Ticket URL: <
https://code.djangoproject.com/ticket/36141>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.