Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.2
-
Fix Version/s: 1.2.3
-
Component/s: Import/Export
-
Labels:None
-
Environment:PHP 5.3.3-dev, mysql 5.1.41
Description
Doctrine_Export::createForeignKey() formats foreign key names, but Doctrine_Export::dropForeignKey() doesn't. It is a problem.
I tested following:
echo "<?php
class addForeignKey extends Doctrine_Migration_Base
{
public function up()Unknown macro: { $this->createForeignKey('user', 'dotted.foreign.key', array( 'local' => 'category_id', 'foreign' => 'id', 'foreignTable' => 'category', )); }}" > migrations/1_add_foreign_key.php
echo "<?php
class removeForeignKey extends Doctrine_Migration_Base
{
public function up()Unknown macro: { $this->dropForeignKey('user', 'dotted.foreign.key'); }}" > migrations/2_add_foreign_key.php
./doctrine migrate 1 # successful
./doctrine migrate 2 # failed
1 error(s) encountered during migration
=======================================
Error #1 - SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name 'dotted'. Failing Query: "ALTER TABLE user DROP FOREIGN KEY dotted.foreign"
I have a patch to fix this problem.
http://github.com/ebihara/doctrine1/commit/6ae3d28a44796dad13d8387b390515ad45fd26aa
I commited a patch to fix this issue to my fork.