Re: Re: MDB2 createTable / createConstraint question
| From: | Mario Gzuk | Date: | Fri, 23 Nov 2007 07:02:07 +0000 |
| Subject: | Re: Re: MDB2 createTable / createConstraint question | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28205@lists.php.net to get a copy of this message | ||
Hi,
thank you for this answer! Yes it helps, but I always have 2 Problems:
This is the table content_grps
array(
'id'=>array(
'type' => 'integer',
'unsigned' => true
),
'parent'=>array(
'type' => 'integer',
'unsigned' => true,
'notnull' => 1,
'default' => 0
),
'group'=>array(
'type' => 'text',
'notnull' => 1,
'length' => 255
),
'modulename'=>array(
'type' => 'text',
'notnull' => 1,
'length' => 255
),
'comment'=>array(
'type' => 'text',
'notnull' => 0,
'length' => 255,
'default' => NULL
)
the table content_to_grp
array(
'id'=>array(
'type' => 'integer',
'unsigned' => true
),
'contentgroupid'=>array(
'type' => 'integer',
'unsigned' => true,
'notnull' => 1,
'default' => 0,
),
'contentid'=>array(
'type' => 'integer',
'unsigned' => true,
'notnull' => 1,
'default' => 0,
),
'contenttype'=>array(
'type' => 'text',
'notnull' => 0,
'length' => 255
)
and the constraint 'fk_contentgroupid'
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',
'match' => 'FULL'
)
In mysql the constraint will be added, but not with the
"CASCADE"-actions and without the name "fk_contentgroupid".
Can anybody see an error in the array?
Thank you again and have a nice day!
greetings mario
Am Donnerstag, den 22.11.2007, 20:09 +0100 schrieb Lorenzo Alberton:
> $options = array('type' => 'innodb');
> $db->manager->createTable($table, $fields, $options);
>
> HTH
>
> Best regards,
> --
> Lorenzo Alberton
> http://pear.php.net/user/quipo
> ________________________________________________________________________
> Quipo Free Internet: sicuro e veloce senza costi di attivazione e senza
> canone, 2 e-mail da 25 Mb, 150 Mb di spazio web e molto di più!
> Registrati gratis: http://www.quipo.it
>