MDB2 trigger problem on multiple table references
| From: | Mario Gzuk | Date: | Tue, 14 May 2013 14:25:27 +0000 |
| Subject: | MDB2 trigger problem on multiple table references | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-31776@lists.php.net to get a copy of this message | ||
Hi,
I have multiple tables which referes to one main tables "id". So I use:
'fk_fusioninventory_antivirus_hardware_id'=>array(
'primary' => 0,
'unique' => 0,
'foreign' => 1,
'check' => 0,
'fields' => array (
'hardware_id' => array(
'position' => 1
)
),
'references' => array(
'table' => 'fusioninventory_hardware',
'fields' => array(
'id' => array(
'position' => 1
)
)
),
'deferrable' => 0,
'initiallydeferred' => 0,
'onupdate' => 'CASCADE',
'ondelete' => 'CASCADE'
)
on each table. For the first table which will be created and which depends on the main table, there will be created an trigger which says that if the fusioninventory_hardware.id is changed please update also this first table. As mysql doesnt support more than one trigger for the same action, the second table which has the same foreign key - there will be no trigger created.
The (damn) effect is that only the first table is updated if I change the id of the main table. If I delete the 2 triggers (update/delete) so that there is no more trigger on the main table, all works fine. All tables which has the foreign key will be updated.
If you want to reproduce that, the table definitions are located here:
http://uranos.svn.sourceforge.net/viewvc/uranos/www/modules/fusioninventory/tables.php
I use the latest version of MDB2:
MDB2 2.5.0b5 betaMDB2_Driver_mysql 1.5.0b4 beta MDB2_Driver_mysqli 1.5.0b4 beta mysqld Ver 5.5.29-0ubuntu0.12.04.2 for debian-linux-gnu on x86_64 ((Ubuntu)) How can I prevent that the mgCreateConstraint creates this triggers or does it come from mysql? I can not find any documentation about that. Thank you