#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

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 Changed 17 months ago by andrewsg

  • Has patch set
  • Needs documentation unset
  • Needs tests unset
  • Owner set to andrewsg
  • Patch needs improvement unset
  • Status changed from new to assigned

comment:2 Changed 16 months ago by mjtamlyn

  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 16 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from assigned to closed

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