diff --git a/lib/Doctrine/Export.php b/lib/Doctrine/Export.php index e3b5d1a46..8e3340add 100644 --- a/lib/Doctrine/Export.php +++ b/lib/Doctrine/Export.php @@ -128,10 +128,21 @@ class Doctrine_Export extends Doctrine_Connection_Module public function dropConstraint($table, $name, $primary = false) { $table = $this->conn->quoteIdentifier($table); - $name = $this->conn->quoteIdentifier($this->conn->formatter->getIndexName($name)); + $name = $this->conn->quoteIdentifier($name); return $this->conn->exec('ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $name); } + /** + * drop existing foreign key + * + * @param string $table name of table that should be used in method + * @param string $name name of the foreign key to be dropped + * @return void + */ + public function dropForeignKey($table, $name) + { + return $this->dropConstraint($table, $name); + } /** * dropSequenceSql * drop existing sequence diff --git a/tests/ExportTestCase.php b/tests/ExportTestCase.php index 900cc5c17..3ff67fa4c 100644 --- a/tests/ExportTestCase.php +++ b/tests/ExportTestCase.php @@ -56,7 +56,7 @@ class Doctrine_Export_TestCase extends Doctrine_UnitTestCase { $this->export->dropConstraint('sometable', 'relevancy'); - $this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT relevancy_idx'); + $this->assertEqual($this->adapter->pop(), 'ALTER TABLE sometable DROP CONSTRAINT relevancy'); } public function testCreateIndexExecutesSql() {