Commit 292d5edd authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-379' into 2.3

parents 97801a74 649bfeb5
...@@ -256,7 +256,7 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -256,7 +256,7 @@ class SQLServerPlatform extends AbstractPlatform
{ {
$constraint = parent::getCreateIndexSQL($index, $table); $constraint = parent::getCreateIndexSQL($index, $table);
if ($index->isUnique()) { if ($index->isUnique() && !$index->isPrimary()) {
$constraint = $this->_appendUniqueConstraintDefinition($constraint, $index); $constraint = $this->_appendUniqueConstraintDefinition($constraint, $index);
} }
......
...@@ -221,4 +221,10 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase ...@@ -221,4 +221,10 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
$idx->addFlag('nonclustered'); $idx->addFlag('nonclustered');
$this->assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->_platform->getCreatePrimaryKeySQL($idx, 'tbl')); $this->assertEquals('ALTER TABLE tbl ADD PRIMARY KEY NONCLUSTERED (id)', $this->_platform->getCreatePrimaryKeySQL($idx, 'tbl'));
} }
public function testAlterAddPrimaryKey()
{
$idx = new \Doctrine\DBAL\Schema\Index('idx', array('id'), false, true);
$this->assertEquals('ALTER TABLE tbl ADD PRIMARY KEY (id)', $this->_platform->getCreateIndexSQL($idx, 'tbl'));
}
} }
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