Modify

Ticket #346 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Duplicate index creation on foreign keys

Reported by: tommi@… Owned by: andrew
Priority: critical Milestone: 0.7
Component: commands Version: 0.7-pre
Keywords: Cc:

Description

Concerning at least changeset 632:3885e6f4db33, seemed to work with yesterday's trunk.

(Using MySQL) Even with model definition as simple as this:

from django.db import models

class Target(models.Model):
    pass

class ProblemModel(models.Model):
    target = models.ForeignKey('Target')

the schemamigration will succeed but migrate will fail, complaining about duplicate key names:

_mysql_exceptions.OperationalError?: (1061, "Duplicate key name 'buggy_problemmodel_target_id'")

Lines 506-507 in south.db.generic.DatabaseOperations?.column_sql seem to cause the problem since the index will be created in the previous foreign key section.

So if you're struggling with your code, comment those lines out. You could end up with missing indices, though.

Used changeset 632:3885e6f4db33,
Django revision 1.2 beta 1 SVN-12403

Attachments

Change History

comment:1 Changed 4 years ago by andrew

  • Status changed from new to assigned
  • Milestone set to 0.7

This is probably related to the fix I did yesterday for the geometry indexes with the contrib.gis stuff. I'll fix it this afternoon.

comment:2 Changed 4 years ago by andrew

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

Fixed in [d138cb5f8930].

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'reopened'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.