Opened 14 months ago
Closed 14 months ago
#34866 closed Bug (needsinfo)
Cannot inspect migrations that replace squashed migrations with sqlmigrate
Reported by: | Giovanni Allegri | Owned by: | Sandeep Pal |
---|---|---|---|
Component: | Migrations | Version: | 4.2 |
Severity: | Normal | Keywords: | |
Cc: | David Wobrock | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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 ...
Change History (4)
comment:1 by , 14 months ago
Summary: | Cannot inspect migrations that resolve (sqaush) previous migrations → Cannot inspect migrations that replaces squashed migrations with sqlmigrate |
---|
comment:2 by , 14 months ago
Summary: | Cannot inspect migrations that replaces squashed migrations with sqlmigrate → Cannot inspect migrations that replace squashed migrations with sqlmigrate |
---|
comment:3 by , 14 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:4 by , 14 months ago
Cc: | added |
---|---|
Easy pickings: | unset |
Resolution: | → needsinfo |
Status: | assigned → closed |
Type: | Uncategorized → Bug |
I cannot reproduce any crash in such a scenario. Please reopen the ticket if you can debug your issue and provide a sample project that reproduces the issue.