#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
------------------------------------+------------------------------------
Comment (by Klaas van Schelven):
> it would be named 0001_initial_squashed_0002_foomodel_bar.py
Not in my world (Django 5.1):
{{{
(freshdjango) $ python manage.py squashmigrations squashme 0002
Will squash the following migrations:
- 0001_initial
- 0002_foomodel_bar
Do you wish to proceed? [y/N] y
Optimizing...
Optimized from 2 operations to 1 operations.
Created new squashed migration
/mnt/datacrypt/dev/squashtest/squashme/migrations/0001_squashed_0002_foomodel_bar.py
You should commit this migration but leave the old ones in place;
the new migration will be used for new installs. Once you are sure
all instances of the codebase have applied the migrations you squashed,
you can delete them.
}}}
> When it had the original name
I'm not sure that line of reasoning matters much to the present
discussion, it's more of a separate annoyance that makes it inconvenient
(impossible even) to specify a specific migration when the full name of
one is the prefix of another... :-D
> I'm not sure it makes sense to migrate backwards to replaced migrations
(and we could error instead of allowing it)
I'm not sure either... but:
> Possibly related: #24900
"Allowed migrating backward to squashed migrations" is the name of the PR,
so it seems this is indeed the ambition
--
Ticket URL: <
https://code.djangoproject.com/ticket/36166#comment:2>
Django <
https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.