[DBAL-132] wrong mysql dump generation for foreign keys Created: 22/Jun/11  Updated: 31/Jul/11  Resolved: 31/Jul/11

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.0.5
Fix Version/s: 2.0.7, 2.1.1

Type: Bug Priority: Major
Reporter: Stefan Zerkalica Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 1
Labels: None
Environment:

PHP 5.3.3-7+squeeze1 with Suhosin-Patch, Debian GNU/Linux 6.0.1 (squeeze)



 Description   

Problem in methods Doctrine\DBAL\Platforms\AbstractPlatform::getDropForeignKeySQL() and Doctrine\DBAL\Platforms\AbstractPlatform::getCreateForeignKeySQL()

This methods do not receive FK name and don't put it in sql dump. While executing dump, mysql autogenerate FK names, but at the migration generation moment doctrine knowns nothing about them.

I think, doctrine must generate this names and put it into the schema.

Autogenerated migrations in mysql with fk are unusable.

Doctrine migrations:migrate in current doctrine version:
up:
ALTER TABLE Catalog_Field ADD CONSTRAINT FOREIGN KEY (groupId) REFERENCES Catalog_FieldGroup(id)
down:
ALTER TABLE Catalog_Field DROP FOREIGN KEY

should be:
up:
ALTER TABLE Catalog_Field ADD CONSTRAINT Catalog_Field_ibfk_2 FOREIGN KEY (groupId) REFERENCES Catalog_FieldGroup(id)
down:
ALTER TABLE Catalog_Field DROP FOREIGN KEY catalog_Field_ibfk_2

see: https://github.com/doctrine/migrations/issues/32

https://github.com/doctrine/migrations/issues/35



 Comments   
Comment by Benjamin Eberlei [ 31/Jul/11 ]

Fixed

Generated at Sat Nov 22 16:40:56 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.