Commit f21a737e authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge pull request #507 from deeky666/fix-sql-anywhere-unique-constraints

Fix unique indexes in CREATE TABLE statements on SQL Anywhere
parents 45e85624 d34e2735
......@@ -1262,12 +1262,8 @@ class SQLAnywherePlatform extends AbstractPlatform
if ( ! empty($options['indexes'])) {
/** @var \Doctrine\DBAL\Schema\Index $index */
foreach ((array) $options['indexes'] as $name => $index) {
if ($index->isUnique()) {
$columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $index);
} else {
$indexSql[] = $this->getCreateIndexSQL($index, $tableName);
}
foreach ((array) $options['indexes'] as $index) {
$indexSql[] = $this->getCreateIndexSQL($index, $tableName);
}
}
......
......@@ -52,7 +52,8 @@ class SQLAnywherePlatformTest extends AbstractPlatformTestCase
public function getGenerateTableWithMultiColumnUniqueIndexSql()
{
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