Commit 17c1ee56 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-492' into 2.3

parents dd69835e 622fe3ca
......@@ -317,7 +317,7 @@ class Comparator
return true;
}
if (strtolower($key1->getForeignTableName()) != strtolower($key2->getForeignTableName())) {
if ($key1->getUnqualifiedForeignTableName() !== $key2->getUnqualifiedForeignTableName()) {
return true;
}
......
......@@ -110,6 +110,17 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
return $this->_foreignTableName;
}
/**
* Return the non-schema qualified foreign table name.
*
* @return string
*/
public function getUnqualifiedForeignTableName()
{
$parts = explode(".", $this->_foreignTableName);
return strtolower(end($parts));
}
/**
* Get the quoted representation of this asset but only if it was defined with one. Otherwise
* return the plain unquoted value as inserted.
......
......@@ -604,6 +604,18 @@ class ComparatorTest extends \PHPUnit_Framework_TestCase
$this->assertFalse($c->diffForeignKey($fk1, $fk2));
}
/**
* @group DBAL-492
*/
public function testCompareForeignKeyNamesUnqualified_AsNoSchemaInformationIsAvailable()
{
$fk1 = new ForeignKeyConstraint(array("foo"), "foo.bar", array("baz"), "fk1");
$fk2 = new ForeignKeyConstraint(array("foo"), "baz.bar", array("baz"), "fk1");
$c = new Comparator();
$this->assertFalse($c->diffForeignKey($fk1, $fk2));
}
public function testDetectRenameColumn()
{
$tableA = new Table("foo");
......
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