[DBAL-313] When creating foreign key constraints, the AbstractPlatform class does not quote the referenced table. Created: 06/Aug/12 Updated: 01/May/13 Resolved: 01/May/13 |
|
| Status: | Resolved |
| Project: | Doctrine DBAL |
| Component/s: | Platforms |
| Affects Version/s: | 2.2.2 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Minor |
| Reporter: | Marc-André Joyal | Assignee: | Benjamin Eberlei |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
I have a table that is using a reserved MySQL keyword (right) and it's quoted in all the generated SQL but not in the foreign key constraint. When I use doctrine.php orm:schema-tool:create I get this SQL line: |
| Comments |
| Comment by Fabio B. Silva [ 26/Aug/12 ] |
|
Hi, Could you try it with doctrine 2.3 ? Thanks.. |
| Comment by Padraig O'Sullivan [ 30/Aug/12 ] |
|
I verified this is fixed in trunk by creating a test. Worth creating pull request to add test case? public function testQuotedForeignKeySQL() { $tableOld = new Table("website"); $tableOld->addColumn('right_id', 'integer'); $tableOld->addUnnamedForeignKeyConstraint('right', array('right_id'), array('id')); $sqls = array(); foreach ($tableOld->getForeignKeys() AS $fk) { $sqls[] = $this->platform->getCreateForeignKeySQL($fk, $tableOld); } $this->assertEquals(array("ALTER TABLE website ADD CONSTRAINT FK_476F5DE754976835 FOREIGN KEY (right_id) REFERENCES `right` (id)"), $sqls); } |
| Comment by Christophe Coevoet [ 30/Aug/12 ] |
|
Can you paste your mapping for your right entity ? |
| Comment by Alexander [ 09/Feb/13 ] |
|
Can you provide us with more feedback? |
| Comment by Benjamin Eberlei [ 01/May/13 ] |
|
Seems fixed as per comment of Patrick. |