Opened 10 years ago

Closed 10 years ago

#24093 closed Bug (fixed)

Migration writer includes kwargs for operations even if they don't occur in the deconstruct output

Reported by: Markus Holtermann Owned by: Markus Holtermann
Component: Migrations Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In 21e21c7bc2b8bf7ae127e2aa75048a60d05a6e0f (#23844) we introduced a way to deterministicly deconstruct migration operations that don't rely on the argument ordering. However, the migration writer still includes all arguments of an operations, since it inspects the operation's __init__() function (see django/db/migrations/writer.py#L51-L52).

This behavior makes migrations generated under 1.8 practically unusable on 1.7, even if they don't use managers in migrations. Due to this I classify this issue as a release blocker.

See also #23892 for a discussion about the forwards / backwards compatibility of migrations.

Change History (4)

comment:1 by Markus Holtermann, 10 years ago

Has patch: set

comment:2 by Carl Meyer, 10 years ago

Severity: Release blockerNormal
Triage Stage: UnreviewedAccepted

As I said on #23892, I don't think we should attempt to make migrations forwards-compatible, and I actually see some advantage to having them fail fast if you try rather than "maybe work depending which features you use." So I don't believe this is high priority or should be a release blocker.

However, I do think this is worth fixing, not for forward-compatibility but just for the sake of cleaner migration files. And if we want it to "fail fast" when you use newer migrations on older Django, we should do that in a more explicit way anyway. So I'm +0 on merging this change.

comment:3 by Markus Holtermann, 10 years ago

It's not about forwards compatibility, at least I didn't consider and think about it. The output is just not the way as it was intended by the change.

comment:4 by Carl Meyer <carl@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 862ea825b5073588efafd5b7eed349ad098b5fe1:

Fixed #24093 -- Prevented MigrationWriter to write operation kwargs that are not explicitly deconstructed

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