On Wed, 2007-05-23 at 16:29 -0700, Fay wrote: > Hi, > > > I encountered a situation that foreign key constraints were generated > differently for the same data model. > > Below is my test model that has 2 identical sets of 1-to-many tables. > When I run django sqlall command, however the foreign key constraints > were built differently, one used column constraint while the other > used table constraint. It seems the table names contribute to this > behavior. Although they function very similarly, I wonder why that > happened.
The constraint on test_x2 had to be added later because at the time table test_x2 was created, there was no table test_x1 to reference. When table test_a2 was created, table test_a1 already existed, so it could include the constraint inline. It's not worth doing a topological sort on the table to make sure everything is a backwards reference (since it's not possible to always achieve that anyway) as the two ways of specifying the constraint lead to identical behaviour. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-users?hl=en -~----------~----~----~----~------~----~------~--~---