Hey guys, ok, been doing a lot of reading the last few days and I think I am nearly ready to start creating some more complex models and associations. But I have a question about Foregin keys.
In the manual (http://manual.cakephp.org/chapter/models -section 4) it shows how to make associations inside the Model. But my question is, in the MySQL creation of the tables, does one have to set the foreign_key (someId) when creating a table? Example, User CREATE TABLE `users` ( `id` int(11) NOT NULL auto_increment, PRIMARY KEY (`id`) ) CREATE TABLE `comments` ( `id` int(11) NOT NULL auto_increment, `comment` text collate latin1_general_ci NOT NULL, `user_id` int(11) NOT NULL auto_increment, # should there be a foreign key here? What would the command look like? PRIMARY KEY (`id`) ) Also, can any one suggest a good (simple!) article about database structure (i.e. when to use UNIQUE, Index, Key, etc...)? Cheers, Rob --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---