Commit e41a6458 authored by Artur Bodera's avatar Artur Bodera Committed by Benjamin Eberlei

Fix schema comparison with FK that contain quoted column names.

parent 121332f1
......@@ -322,11 +322,11 @@ class Comparator
*/
public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2)
{
if (array_map('strtolower', $key1->getLocalColumns()) != array_map('strtolower', $key2->getLocalColumns())) {
if (array_map('strtolower', $key1->getUnquotedLocalColumns()) != array_map('strtolower', $key2->getUnquotedLocalColumns())) {
return true;
}
if (array_map('strtolower', $key1->getForeignColumns()) != array_map('strtolower', $key2->getForeignColumns())) {
if (array_map('strtolower', $key1->getUnquotedForeignColumns()) != array_map('strtolower', $key2->getUnquotedForeignColumns())) {
return true;
}
......
......@@ -163,6 +163,26 @@ class ForeignKeyConstraint extends AbstractAsset implements Constraint
return $columns;
}
/**
* Returns unquoted representation of local table column names for comparison with other FK
*
* @return array
*/
public function getUnquotedLocalColumns()
{
return array_map(array($this, 'trimQuotes'), $this->getLocalColumns());
}
/**
* Returns unquoted representation of foreign table column names for comparison with other FK
*
* @return array
*/
public function getUnquotedForeignColumns()
{
return array_map(array($this, 'trimQuotes'), $this->getForeignColumns());
}
/**
* {@inheritdoc}
*
......
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