Re: syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-12 Thread physicsnick
Hmm. It seems to be database-specific. PostgreSQL and Oracle require that foreign key references be unique, while MySQL and SQLite do not (although for SQLite that's mainly due to it not actually implementing foreign key constraints). The MySQL documentation has this to say: >> Additionally,

Re: syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-11 Thread Malcolm Tredinnick
On Tue, 2009-08-11 at 12:00 -0700, physicsnick wrote: > Actually they don't need to be unique (and I don't want them to be > unique). MySQL does not require that foreign keys be unique; only that > they be indexed. > > I am actually using this for a temporal database. There are many > instances

Re: syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-11 Thread physicsnick
Actually they don't need to be unique (and I don't want them to be unique). MySQL does not require that foreign keys be unique; only that they be indexed. I am actually using this for a temporal database. There are many instances of an Author with the same code (an instance for each time it was

Re: syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-10 Thread Karen Tracey
On Mon, Aug 10, 2009 at 3:52 PM, physicsnick wrote: > > Hello, > > I'm trying to use ForeignKey on a specific indexed column using the > to_field attribute. Unfortunately syncdb seems to be outputting the > ADD CONSTRAINT statement before the CREATE INDEX on the to_field,

syncdb with ForeignKey to_field outputs statements in wrong order

2009-08-10 Thread physicsnick
Hello, I'm trying to use ForeignKey on a specific indexed column using the to_field attribute. Unfortunately syncdb seems to be outputting the ADD CONSTRAINT statement before the CREATE INDEX on the to_field, so mysql refuses to add the constraint and syncdb quits with an exception. Here's a