Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Commit

Permalink
Synchronizing Doctrine 1 SVN with git
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan H. Wage committed Jun 8, 2010
1 parent b9a297f commit 918a87d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/Doctrine/Export.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* $Id: Export.php 7490 2010-03-29 19:53:27Z jwage $
* $Id: Export.php 7653 2010-06-08 15:54:31Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Expand Down Expand Up @@ -29,7 +29,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 1.0
* @version $Revision: 7490 $
* @version $Revision: 7653 $
*/
class Doctrine_Export extends Doctrine_Connection_Module
{
Expand Down Expand Up @@ -148,7 +148,7 @@ public function dropConstraint($table, $name, $primary = false)
*/
public function dropForeignKey($table, $name)
{
return $this->dropConstraint($table, $name);
return $this->dropConstraint($table, $this->conn->formatter->getForeignKeyName($name));
}

/**
Expand Down Expand Up @@ -1386,4 +1386,4 @@ public function exportTable(Doctrine_Table $table)
}
}
}
}
}
8 changes: 4 additions & 4 deletions lib/Doctrine/Export/Mysql.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/*
* $Id: Mysql.php 7647 2010-06-08 15:26:00Z jwage $
* $Id: Mysql.php 7653 2010-06-08 15:54:31Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
Expand Down Expand Up @@ -29,7 +29,7 @@
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @link www.doctrine-project.org
* @since 1.0
* @version $Revision: 7647 $
* @version $Revision: 7653 $
*/
class Doctrine_Export_Mysql extends Doctrine_Export
{
Expand Down Expand Up @@ -812,8 +812,8 @@ public function dropTableSql($table)
public function dropForeignKey($table, $name)
{
$table = $this->conn->quoteIdentifier($table);
$name = $this->conn->quoteIdentifier($name);
$name = $this->conn->quoteIdentifier($this->conn->formatter->getForeignKeyName($name));

return $this->conn->exec('ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $name);
}
}
}
8 changes: 8 additions & 0 deletions tests/ExportTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,12 @@ public function testExport()
{

}
public function testDropDottedForeignKey()
{
$this->export->dropForeignKey('sometable', 'normal_foreign_key');
$this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT normal_foreign_key');

$this->export->dropForeignKey('sometable', 'dotted.foreign.key');
$this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT dotted_foreign_key');
}
}

0 comments on commit 918a87d

Please sign in to comment.