#36166: Backwards migration to replaced migration leads to
InconsistentMigrationHistory on forward migrate
------------------------------------+------------------------------------
Reporter: Klaas van Schelven | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: 5.1
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
------------------------------------+------------------------------------
Changes (by Sarah Boyce):
* stage: Unreviewed => Accepted
* summary: squashmigrations breaks backward migration detection =>
Backwards migration to replaced migration leads to
InconsistentMigrationHistory on forward migrate
Comment:
Note that if you were to recreate the squashed migration, it would be
named `0001_initial_squashed_0002_foomodel_bar.py` but it appears the file
and dependency was renamed to `0001_squashed_0002_foomodel_bar.py`.
When it had the original name, we do not hit the
`InconsistentMigrationHistory` error because doing `python manage.py
migrate squashme 0001_initial` gives:
`CommandError: More than one migration matches '0001_initial' in app
'squashme'. Please be more specific.`
Note that doing `python manage.py migrate squashme zero` and then migrate
still un-applies and applies the migration correctly (this is also true
with the renamed migration)
I'm not sure it makes sense to migrate backwards to replaced migrations
(and we could error instead of allowing it)
Replicated on 5.1 and main. Thank you for the ticket and project 👍
Possibly related #24900
--
Ticket URL: <https://code.djangoproject.com/ticket/36166#comment:1>
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/01070194d0244ac8-78962e4c-117c-4218-96a8-9c488311ced0-000000%40eu-central-1.amazonses.com.