[DBAL-148] Foreign key creation fails with MySQL 5.1.54 Created: 16/Aug/11  Updated: 18/Aug/11  Resolved: 18/Aug/11

Status: Resolved
Project: Doctrine DBAL
Component/s: None
Affects Version/s: 2.1
Fix Version/s: 2.1

Type: Bug Priority: Major
Reporter: Frej Connolly Assignee: Benjamin Eberlei
Resolution: Fixed Votes: 0
Labels: None

MySQL 5.1.54, PHP 5.3.5, Ubuntu 11.04, Zend Framework 1.11.10

Attachments: Text File git_commit_9242fb332baaaeb81be4.txt     File Job.php     Text File orm_schema-tool_create--dump-sql.txt     File Position.php    


doctrine orm:schema-tool:create


SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Position(id)' at line 1

The problem seem to be that the create commande creates the following SQL syntax
ALTER TABLE Job ADD FOREIGN KEY (position_id) REFERENCES Position(id);

which doesn't work. If I use the following (added a space between Postion and (id) in the end) it works.
ALTER TABLE Job ADD FOREIGN KEY (position_id) REFERENCES Position (id);

Patch for AbstractPlatform.php attached.

Comment by Benjamin Eberlei [ 18/Aug/11 ]

Fixed and merged 2.1.x

Generated at Sun Oct 04 05:28:51 EDT 2015 using JIRA 6.4.10#64025-sha1:5b8b74079161cd76a20ab66dda52747ee6701bd6.