MigrationWriter doesn't serialise elidable kwarg
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)
| Owner: |
set to SnippyCodes
|
| Status: |
new → assigned
|
| Triage Stage: |
Unreviewed → Accepted
|
| Patch needs improvement: |
set
|
| Patch needs improvement: |
unset
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
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