#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 Giovanni Allegri, 15 months ago

Summary: Cannot inspect migrations that resolve (sqaush) previous migrationsCannot inspect migrations that replaces squashed migrations with sqlmigrate

comment:2 by Giovanni Allegri, 15 months ago

Summary: Cannot inspect migrations that replaces squashed migrations with sqlmigrateCannot inspect migrations that replace squashed migrations with sqlmigrate

comment:3 by Sandeep Pal, 15 months ago

Owner: changed from nobody to Sandeep Pal
Status: newassigned

comment:4 by Mariusz Felisiak, 15 months ago

Cc: David Wobrock added
Easy pickings: unset
Resolution: needsinfo
Status: assignedclosed
Type: UncategorizedBug

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 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.

Note: See TracTickets for help on using tickets.
Back to Top