[Django] #34866: Cannot inspect migrations that resolve (sqaush) previous migrations

4 views
Skip to first unread message

Django

unread,
Sep 22, 2023, 7:12:27 AM9/22/23
to django-...@googlegroups.com
#34866: Cannot inspect migrations that resolve (sqaush) previous migrations
--------------------------------------------+------------------------
Reporter: Giovanni Allegri | Owner: nobody
Type: Uncategorized | Status: new
Component: Migrations | Version: 4.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
--------------------------------------------+------------------------
Commit
https://github.com/django/django/commit/d88365708c554efe3c786c3be6da1d9de916360f
forces MigrationLoader with replace_migrations=False. This is fine to
inspect squashed migrations, as requested in
https://code.djangoproject.com/ticket/31318.

However, in case the squashed migrations remove a model or a field, the
command breaks when it reaches the migration that replaces the squashed
migrations. since this will try to modify a model that was already removed
(by the squashed migrations).

I propose to make the replace_migrations controllable with a parameter to
sqlmigrate. If not set the option will be False (as it is now by default).
The following command would make sqlmigrate replace squashed migrations:


{{{
django-admin sqlmigrate --replace-migrations ...
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/34866>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Reply all
Reply to author
Forward
0 new messages