MDB2 createConstraint BUG?
| From: | Mario Gzuk | Date: | Sat, 24 Nov 2007 08:09:43 +0000 |
| Subject: | MDB2 createConstraint BUG? | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28213@lists.php.net to get a copy of this message | ||
Hi,
this constraint:
$arr=array(
'primary' => 0,
'unique' => 0,
'foreign' => 1,
'check' => 0,
'fields' => array (
'contentgroupid' => array(
'position' => 1
)
),
'references' => array(
'table' => 'content_grps',
'fields' => array(
'id' => array(
'position' => 1
)
)
),
'deferrable' => 0,
'initiallydeferred' => 0,
'onupdate' => 'CASCADE',
'ondelete' => 'CASCADE'
);
$db->mgCreateConstraint('content_to_grp', 'fk_contentgroupid', $arr);
produce this sql:
ALTER TABLE
content_to_grp ADD FOREIGN KEY fk_contentgroupid_idx
(contentgroupid) REFERENCES content_grps (id) ON UPDATE
CASCADE ON
DELETE CASCADE;
But it should:
http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
ALTER TABLE content_to_grp
ADD CONSTRAINT fk_contentgroupid_idx FOREIGN KEY (contentgroupid)
REFERENCES content_grps (id) ON DELETE CASCADE ON UPDATE CASCADE;
pear5 list:
MDB2 2.5.0a1 alpha
MDB2_Driver_mysql 1.5.0a1 alpha
Is this correct or a bug?
greetings mario