Commit d34e2735 authored by Steve Müller's avatar Steve Müller

fix unique indexes in CREATE TABLE statements on SQL Anywhere

parent 2790ee79
...@@ -1266,12 +1266,8 @@ class SQLAnywherePlatform extends AbstractPlatform ...@@ -1266,12 +1266,8 @@ class SQLAnywherePlatform extends AbstractPlatform
if ( ! empty($options['indexes'])) { if ( ! empty($options['indexes'])) {
/** @var \Doctrine\DBAL\Schema\Index $index */ /** @var \Doctrine\DBAL\Schema\Index $index */
foreach ((array) $options['indexes'] as $name => $index) { foreach ((array) $options['indexes'] as $index) {
if ($index->isUnique()) { $indexSql[] = $this->getCreateIndexSQL($index, $tableName);
$columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $index);
} else {
$indexSql[] = $this->getCreateIndexSQL($index, $tableName);
}
} }
} }
......
...@@ -52,7 +52,8 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase ...@@ -52,7 +52,8 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
public function getGenerateTableWithMultiColumnUniqueIndexSql() public function getGenerateTableWithMultiColumnUniqueIndexSql()
{ {
return array( return array(
'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL, CONSTRAINT UNIQ_D87F7E0C8C73652176FF8CAA UNIQUE (foo, bar))', 'CREATE TABLE test (foo VARCHAR(255) DEFAULT NULL, bar VARCHAR(255) DEFAULT NULL)',
'CREATE UNIQUE INDEX UNIQ_D87F7E0C8C73652176FF8CAA ON test (foo, bar)'
); );
} }
......
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