Ticket #1029 (closed defect: invalid)

Opened 4 years ago

Last modified 3 years ago

Data migration that delete rows does not work - MySQL

Reported by: proman@… Owned by: andrew
Priority: major Milestone: 1.0
Component: commands Version: 0.7.3
Keywords: Cc:


I created a data migration that deletes some rows that are referenced by other rows.

Code is as simple as this:

def forwards(self, orm):


When I run this migration I get integrity errors from database (I'm using MySQL 5.1 with InnoDB storage backend)

django.db.utils.IntegrityError?: (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (myproj.payment_billingrecord, CONSTRAINT account_id_refs_id_3c8fc05 FOREIGN KEY (account_id) REFERENCES accounts_account (id))')

Running the very same Account.objects.all().delete() from django shell works without any problems - all child objects are nicely deleted.

This problem is identical to this: http://south.aeracode.org/ticket/165 which is marked as fixed. I am not sure if it is database-related issue, in the other ticket it was about postgres, here it's MySQL. My south version is 0.7.3.

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to infoneeded
  • Milestone set to 1.0

Please re-try with the latest South development code - 0.7.3 is quite old now, and we're doing a new release soon.

comment:2 Changed 3 years ago by andrew

  • Status changed from infoneeded to closed
  • Resolution set to invalid

No info provided, closing.

Note: See TracTickets for help on using tickets.