Ticket #98 (closed defect: fixed)

Opened 6 years ago

Last modified 3 years ago

autodetection misses Meta.unique_together

Reported by: bendavis78@… Owned by: andrew
Priority: major Milestone: 0.5
Component: commands Version: 0.6-pre
Keywords: Cc:

Description

myapp/models.py:

class Foo(Model):
    bar = CharField(max_length=255)
    baz = CharField(max_length=255)
    
    class Meta:
        unique_together = ('bar', 'baz')

dbshell:

mysql> SHOW CREATE TABLE myapp_foo\G
*************************** 1. row ***************************
       Table: myapp_foo
Create Table: CREATE TABLE `myapp_foo` (
  `id` int(11) NOT NULL auto_increment,
  `bar` varchar(255) NOT NULL,
  `baz` varchar(255) NOT NULL,
  PRIMARY KEY  (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)

Would expect to see the following in the table definition:

UNIQUE KEY 'bar' ('bar', 'baz')

Change History

comment:1 Changed 6 years ago by andrew

  • Status changed from new to assigned

Yup, this is because I haven't written it yet. It's on the list :)

comment:2 Changed 5 years ago by andrew

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

OK, uniques for new models came in a week or two back, and [220] fixes detection of changes.

Note: See TracTickets for help on using tickets.