Opened 17 months ago

Closed 17 months ago

Last modified 17 months 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: master
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 Changed 17 months ago by charettes

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 17 months ago by Simon Charette <charette.s@…>

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

In 0e45669fa9eb82c6de8e226c6da53ab5e88575f5:

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

comment:3 Changed 17 months ago by Simon Charette <charette.s@…>

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