Commit c48effb6 authored by Steve Müller's avatar Steve Müller Committed by GitHub

Merge pull request #2715 from dhensby/pulls/fix-2714

FIX Sequence::isAutoIncrementsFor now case insensitive
parents e98d2416 106097a3
......@@ -149,7 +149,7 @@ class Sequence extends AbstractAsset
$sequenceName = $this->getShortestName($table->getNamespaceName());
$tableName = $table->getShortestName($table->getNamespaceName());
$tableSequenceName = sprintf('%s_%s_seq', $tableName, $pkColumns[0]);
$tableSequenceName = sprintf('%s_%s_seq', $tableName, $column->getShortestName($table->getNamespaceName()));
return $tableSequenceName === $sequenceName;
}
......
......@@ -24,5 +24,24 @@ class SequenceTest extends \Doctrine\Tests\DbalTestCase
$this->assertFalse($sequence2->isAutoIncrementsFor($table));
$this->assertFalse($sequence3->isAutoIncrementsFor($table));
}
public function testIsAutoincrementForCaseInsensitive()
{
$table = new Table('foo');
$table->addColumn('ID', 'integer', array('autoincrement' => true));
$table->setPrimaryKey(array('ID'));
$sequence = new Sequence("foo_id_seq");
$sequence1 = new Sequence("foo_ID_seq");
$sequence2 = new Sequence("bar_id_seq");
$sequence3 = new Sequence("bar_ID_seq");
$sequence4 = new Sequence("other.foo_id_seq");
$this->assertTrue($sequence->isAutoIncrementsFor($table));
$this->assertTrue($sequence1->isAutoIncrementsFor($table));
$this->assertFalse($sequence2->isAutoIncrementsFor($table));
$this->assertFalse($sequence3->isAutoIncrementsFor($table));
$this->assertFalse($sequence4->isAutoIncrementsFor($table));
}
}
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