Ticket #346 (closed defect: fixed)
Duplicate index creation on foreign keys
|Reported by:||tommi@…||Owned by:||andrew|
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