Opened 19 years ago
Closed 19 years ago
#4191 closed (duplicate)
manage.py sqlindexes generates wrong sql code
| Reported by: | litnimax | Owned by: | Adrian Holovaty |
|---|---|---|---|
| Component: | Core (Management commands) | Version: | dev |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Pls see example below:
Model:
class SpeedDial(models.Model):
account = models.ForeignKey(VoipAccount, editable=False)
sequence = models.CharField(maxlength=1)
number = models.CharField(maxlength=20)
def __str__(self):
return '%s' % self.sequence
class Admin:
list_display = ('sequence', 'number')
list_display_links = ('sequence', 'number')
class Meta:
ordering = ('sequence', )
unique_together = (('sequence','account'),)
max@explorer ~/Development/public/dtl/r_manager/trunk/rmanager $ python manage.py sqlall pbx
BEGIN;
CREATE TABLE `pbx_speeddial` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`account_id` integer NOT NULL REFERENCES `ENTVOIPACCT` (`ATRACCTID`),
`sequence` varchar(1) NOT NULL,
`number` varchar(20) NOT NULL,
UNIQUE (`sequence`, `account_id`)
);
CREATE INDEX `pbx_speeddial_account_id` ON `pbx_speeddial` (`account_id`);
COMMIT;
But when we issue:
max@explorer ~/Development/public/dtl/r_manager/trunk/rmanager $ python manage.py sqlindexes pbx CREATE INDEX `pbx_speeddial_account_id` ON `pbx_speeddial` (`account_id`);
it only generates index for foreign key.
What about uniq index!?
Note:
See TracTickets
for help on using tickets.
Duplicate of #4192