[Django] #36893: MigrationWriter doesn't serialise elidable kwarg

0 views
Skip to first unread message

Django

unread,
Jan 29, 2026, 11:03:39 PM (4 hours ago) Jan 29
to django-...@googlegroups.com
#36893: MigrationWriter doesn't serialise elidable kwarg
-----------------------------------+--------------------------------------
Reporter: lgreville | Type: Bug
Status: new | Component: Migrations
Version: 6.0 | Severity: Normal
Keywords: migrations runsql | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------------------------
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
--
Ticket URL: <https://code.djangoproject.com/ticket/36893>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 29, 2026, 11:04:30 PM (4 hours ago) Jan 29
to django-...@googlegroups.com
#36893: MigrationWriter doesn't serialise elidable kwarg
-----------------------------------+--------------------------------------
Reporter: lgreville | Owner: (none)
Type: Bug | Status: new
Component: Migrations | Version: 6.0
Severity: Normal | Resolution:
Keywords: migrations runsql | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+--------------------------------------
Changes (by Jarek Glowacki):

* cc: Jarek Glowacki (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/36893#comment:1>

Django

unread,
Jan 29, 2026, 11:55:24 PM (3 hours ago) Jan 29
to django-...@googlegroups.com
#36893: MigrationWriter doesn't serialise elidable kwarg
-----------------------------------+---------------------------------------
Reporter: Leigh Greville | Owner: SnippyCodes
Type: Bug | Status: assigned
Component: Migrations | Version: 6.0
Severity: Normal | Resolution:
Keywords: migrations runsql | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by SnippyCodes):

* owner: (none) => SnippyCodes
* status: new => assigned

--
Ticket URL: <https://code.djangoproject.com/ticket/36893#comment:2>

Django

unread,
12:19 AM (2 hours ago) 12:19 AM
to django-...@googlegroups.com
#36893: MigrationWriter doesn't serialise elidable kwarg
-----------------------------------+---------------------------------------
Reporter: Leigh Greville | Owner: SnippyCodes
Type: Bug | Status: assigned
Component: Migrations | Version: 6.0
Severity: Normal | Resolution:
Keywords: migrations runsql | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+---------------------------------------
Changes (by SnippyCodes):

* has_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36893#comment:3>

Django

unread,
12:43 AM (2 hours ago) 12:43 AM
to django-...@googlegroups.com
#36893: MigrationWriter doesn't serialise elidable kwarg
-----------------------------------+---------------------------------------
Reporter: Leigh Greville | Owner: SnippyCodes
Type: Bug | Status: assigned
Component: Migrations | Version: 6.0
Severity: Normal | Resolution:
Keywords: migrations runsql | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------------+---------------------------------------
Comment (by SnippyCodes):

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
--
Ticket URL: <https://code.djangoproject.com/ticket/36893#comment:4>
Reply all
Reply to author
Forward
0 new messages