Hi everyone,
I'm trying to create a migration in CakePHP 1.2 that will add a table
for a HABTM relationship and set the foreign keys for it. Here's my
code (generated via 'cake schema generate', selecting 'snapshot'):
// --snip --
var $phones_phone_features = array(
'id' => array('type' => 'integer', 'null' => false, 'default' =>
NULL, 'key' => 'primary'),
'phones_id' => array('type' => 'integer', 'null' => false,
'default'
=> 1, 'foreignKey' => 'phones.id'),
'phone_features_id' => array('type' => 'integer', 'null' =>
false,
'default' => 1, 'foreignKey' => 'phone_features.id'),
'indexes' => array('PRIMARY' => array('column' => 'id',
'unique' =>
1))
);
}
// --snip--
As you can see, I have 'foreignKey' specified, but the resulting SQL
(I'm using MySQL to develop, deploying on Oracle) doesn't contain a
foreign key definition:
Dry run for phones_phone_features :
CREATE TABLE `phones_phone_features` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`phones_id` int(11) DEFAULT 1 NOT NULL,
`phone_features_id` int(11) DEFAULT 1 NOT NULL, PRIMARY KEY (`id`));
So how exactly am I supposed to tell cake's migration shell to assign
foreign keys correctly?
Thanks for any help you can supply.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---