Opened 5 years ago

Closed 5 years ago

#22095 closed Bug (fixed)

Migrations containing RunPython operations cannot be reversed regardless of reverse_code

Reported by: andrewsg Owned by: andrewsg
Component: Migrations Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Migrations including RunPython cannot be reversed, regardless of whether reverse_code is supplied to RunPython. Code appears to be in place to make the reverse operation function if reverse_code is supplied, but the "reversible" attribute on the RunPython class is set to False.

RunSQL is analogous to RunPython and solves this problem by making reversible a property that returns True if reverse_sql is supplied to that constructor, so presumably the same would work for RunPython.

Change History (3)

comment:1 Changed 5 years ago by andrewsg

Has patch: set
Owner: set to andrewsg
Status: newassigned

comment:2 Changed 5 years ago by Marc Tamlyn

Triage Stage: UnreviewedReady for checkin

comment:3 Changed 5 years ago by Baptiste Mispelon <bmispelon@…>

Resolution: fixed
Status: assignedclosed

In 202bf69c2f69d9ee20ac3fd409116a8946dc0784:

Fixed #22095 -- Enabled backward migrations for RunPython operations

Added reversible property to RunPython so that migrations will not
refuse to reverse migrations including RunPython operations, so long as
reverse_code is set in the RunPython constructor. Included tests to
check the reversible property on RunPython and the similar RunSQL.

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