Hi everyone, I'm currently creating a table called "Foods_Ingredients", here is the sql:
CREATE TABLE IF NOT EXISTS `foods_ingredients` ( `food_id` int(11) NOT NULL AUTO_INCREMENT, `ingredient_id` int(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`food_id`,`ingredient_id`) ) ENGINE=InnoDB ------------------------------ The problem now is I find this table has to have composite primary key. Cake currently doesn't support composite, I'm not sure what is the workaround for this. 1. Do I change to UNIQUE KEY ? I went briefly with the cookbook, finding it hard to understand, can anyone suggest a solution for this ? 2. Do I just add a field `id` into it ?--so it becomes the PK? Adding this seems a bit odd. -------------------------------- CREATE TABLE IF NOT EXISTS `foods_ingredients` ( `id` int(11) NOT NULL AUTO_INCREMENT, `food_id` int(11) NOT NULL, `ingredient_id` int(11) NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `food_id_ingredient_id` (`food_id`,`ingredient_id`) ) ENGINE=InnoDB ------------------------------------ What is the suggested solution for this ? from veterans/experienced Cake users. Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
