#36141: After double squashing migrate command fails with
InconsistentMigrationHistory
---------------------------------+--------------------------------------
Reporter: Jacob Walls | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: 6.0
Severity: Release blocker | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Description changed by Natalia Bidart:
Old description:
> [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.
New description:
Ticket #24529 implemented the possibility to squash squashed migrations.
To reproduce this issue, 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#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/0107019a930317f2-8d055faf-93e9-4bef-9846-b64c1acc527a-000000%40eu-central-1.amazonses.com.