Opened 2 hours ago
#36643 new Bug
Migrate should not check for consistent history when faking migrations
Reported by: | Alexandru Chirila | Owned by: | |
---|---|---|---|
Component: | Migrations | Version: | 5.2 |
Severity: | Normal | Keywords: | |
Cc: | Alexandru Chirila | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
If for some reason or another you end up needing to fake apply a migration, it will still run the check_consistent_history
.
So if you ended up by accident (or on purpose somehow?) with a invalid migration history, there is no way of fixing it except manually doing things in the django_migrations
table.
It seems like a scenario like this ought to be fixable using the "fake" apply of migrations, but as far as I can tell there is no way of doing that as the check will always fell and throw an error, so the fake aplication can never be done.
.venv/lib/python3.12/site-packages/django/db/migrations/loader.py", line 327, in check_consistent_history raise InconsistentMigrationHistory( django.db.migrations.exceptions.InconsistentMigrationHistory: Migration shortner.0001_initial is applied before its dependency charts.0001_initial on database 'default'.