Commit a14db264 authored by romanb's avatar romanb

reapplied my changes to Export.php that were (accidently?) reverted by jonwage

parent 2d1b5cc6
...@@ -128,10 +128,21 @@ class Doctrine_Export extends Doctrine_Connection_Module ...@@ -128,10 +128,21 @@ class Doctrine_Export extends Doctrine_Connection_Module
public function dropConstraint($table, $name, $primary = false) public function dropConstraint($table, $name, $primary = false)
{ {
$table = $this->conn->quoteIdentifier($table); $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); 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 * dropSequenceSql
* drop existing sequence * drop existing sequence
......
...@@ -56,7 +56,7 @@ class Doctrine_Export_TestCase extends Doctrine_UnitTestCase ...@@ -56,7 +56,7 @@ class Doctrine_Export_TestCase extends Doctrine_UnitTestCase
{ {
$this->export->dropConstraint('sometable', 'relevancy'); $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() public function testCreateIndexExecutesSql()
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment