Opened 10 years ago

Closed 10 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: dev
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

Description

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 by andrewsg, 10 years ago

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

comment:2 by Marc Tamlyn, 10 years ago

Triage Stage: UnreviewedReady for checkin

comment:3 by Baptiste Mispelon <bmispelon@…>, 10 years ago

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