Opened 3 weeks ago

Closed 3 weeks ago

#36893 closed Bug (fixed)

MigrationWriter doesn't serialise elidable kwarg

Reported by: Leigh Greville Owned by: SnippyCodes
Component: Migrations Version: 6.0
Severity: Normal Keywords: migrations runsql
Cc: Jarek Glowacki Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

If a migration has elidable RunSQL operations and is serialised by MigrationWriter, they will be serialised without the elidable kwarg. This means they will now be treated as unelidable.

This issue came up for me recently when automatically generating a migration to remove stale tables/columns: the generated migration contains elidable RunSQL operations to drop the stale data, but when they are serialised they are no longer marked as elidable.

This has likely not cropped up before, as MigrationWriter is typically used by the squash command, which never needs to write the operation (cause it gets thrown away if it's elidable).

Someone from my company can pick this up if it's accepted

Change History (8)

comment:1 by Jarek Glowacki, 3 weeks ago

Cc: Jarek Glowacki added

comment:2 by SnippyCodes, 3 weeks ago

Owner: set to SnippyCodes
Status: newassigned

comment:3 by SnippyCodes, 3 weeks ago

Has patch: set

comment:4 by SnippyCodes, 3 weeks ago

I have submitted a PR that fixes this issue by ensuring elidable=True is serialized in Run-SQL and Run -Python operations. I've also added regression tests. PR - https://github.com/django/django/pull/20614

comment:5 by Jacob Walls, 3 weeks ago

Triage Stage: UnreviewedAccepted

comment:6 by Jacob Walls, 3 weeks ago

Patch needs improvement: set

comment:7 by Jacob Walls, 3 weeks ago

Patch needs improvement: unset
Triage Stage: AcceptedReady for checkin

comment:8 by Jacob Walls <jacobtylerwalls@…>, 3 weeks ago

Resolution: fixed
Status: assignedclosed

In 1d4c52c:

Fixed #36893 -- Serialized elidable kwarg for RunSQL and RunPython operations.

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