Ticket #346 (closed defect: fixed)
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:2 Changed 3 years ago by andrew
- Status changed from assigned to closed
- Resolution set to fixed
Fixed in [d138cb5f8930].

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.