On Wed, 2006-07-19 at 11:24 +0000, DavidA wrote:
> 
> Alexis Smirnov wrote:
> > ALTER TABLE `console_restoreevent` ADD CONSTRAINT
> > `identity_id_referencing_console_identity_id` FOREIGN KEY (`identity_i
> > d`) REFERENCES `console_identity` (`id`);
> > ALTER TABLE `console_backupevent` ADD CONSTRAINT
> > `identity_id_referencing_console_identity_id` FOREIGN KEY (`identity_id
> > `) REFERENCES `console_identity` (`id`);
> > COMMIT;
> >
> > Questions:
> >  - Any idea why MySQL 5.0.20-nt does't like above SQL?
> >  - Is it a good idea to try to create SQL that respects the order of classes
> > within .py file (thus avoiding ALTER TABLE)
> >  - If so, do you think the fix above is the right one?
> 
> MySQL requires each constraint to have the same name. 

I'm pretty sure you meant to say "different name" there. :-)

> If you have two
> FK fields to the same model, with the same name, the current naming
> scheme will generate the same exact constraint name. That's what the
> cryptic MySQL error is about (both of your constraints are named
> `identity_id_referencing_console_identity_id`). It seems an easy fix
> would be to add the referencing table name to the constraint name but
> there are 64-character limits to these names in MySQL. In fact, I think
> it used to work that way and was changed to work around the length
> problem, which now triggers a new one.

The problem should be fixed in r3373 and it only costs two extra
characters for a duplicated relation (unless you have more than 10 with
the same potential name, in which case, it'll cost you one more
character).

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to