Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#22460 closed Bug (fixed)

Fix of removal of a ForeignKey field in a migration in MySQL

Reported by: motiejus Owned by: nobody
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

Consider the following:

  1. A model has a ForeignKey() field.
  2. Migration tries to remove it.
  3. BAM! in MySQL:
OperationalError: (1025, "Error on rename of './test_myapp/test_rfk_rider' to './test_myapp/#sql2-3398-2e8' (errno: 152)")

Here is a patch with a regression test: https://github.com/django/django/pull/2571

Change History (3)

comment:1 by Simon Charette, 10 years ago

Triage Stage: UnreviewedAccepted

comment:2 by Simon Charette <charette.s@…>, 10 years ago

Resolution: fixed
Status: newclosed

In 0e45669fa9eb82c6de8e226c6da53ab5e88575f5:

Fixed #22460 -- Explicity remove constraints when dropping a related field.

comment:3 by Simon Charette <charette.s@…>, 10 years ago

In 71c8ae543ffec847ec275859bc406202f5029604:

[1.7.x] Fixed #22460 -- Explicity remove constraints when dropping a related field.

Backport of 0e45669fa9 from master

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