#36141 closed Bug (invalid)
After double squashing migrate command fails with InconsistentMigrationHistory
Reported by: | Jacob Walls | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Georgi Yanchev | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
[main/6.0]
Make four migrations, migrate, squash the first two, then squash the first three: then migrate (or makemigrations --check) fails.
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.
Change History (3)
comment:1 by , 9 hours ago
Cc: | added |
---|
comment:2 by , 9 hours ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Closing as "needsinfo", pending feedback from Jacob in case there's something I'm missing or a docs change might help.
comment:3 by , 4 hours ago
Resolution: | needsinfo → invalid |
---|---|
Severity: | Release blocker → Normal |
Ah right thanks. Was trying to distill a more complicated failure and went a little too far. Docs read fine!
Note:
See TracTickets
for help on using tickets.
You should run migrate after each squash:
Do you think this needs to be clearer in the docs?