More on migration:
The following code(excerpt):
'references' => array(
new Reference('ibfk_2', array(
'referencedSchema' => 'dbschema',
'referencedTable' => 'table1',
'columns' => array('column1_id'),
'referencedColumns' => array('id')
)),
new Reference('ibfk_3', array(
'referencedSchema' => 'dbschema',
'referencedTable' => 'table2',
'columns' => array('column2_id'),
'referencedColumns' => array('id')
))
),
Generates this Mysql query, which doesn't work:
CREATE TABLE `dbschema`.`table` ( `column1_id` INT(10) UNSIGNED NOT NULL, `column2_id` INT(10) UNSIGNED NOT NULL PRIMARY KEY (`column1_id`, `column2_id`), KEY `column1_id` (`column1_id`), CONSTRAINT `ibfk_2` FOREIGN KEY (`id`) REFERENCES `column1_id`(`id`), CONSTRAINT `ibfk_3` FOREIGN KEY (`id`) REFERENCES `column2_id`(`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci
The problem is that:
CONSTRAINT `ibfk_2` FOREIGN KEY (`id`) REFERENCES `column1_id`(`id`),
should be:
CONSTRAINT `ibfk_2` FOREIGN KEY (`column1_id`) REFERENCES `column1_id`(`id`),