Commit 43fb16ef authored by Gareth Evans's avatar Gareth Evans Committed by Steve Müller

Move index name quote to abstract

parent aac65338
...@@ -1617,7 +1617,10 @@ abstract class AbstractPlatform ...@@ -1617,7 +1617,10 @@ abstract class AbstractPlatform
if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
foreach ($options['uniqueConstraints'] as $name => $definition) { foreach ($options['uniqueConstraints'] as $name => $definition) {
$columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition); $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL(
$definition->getQuotedName($this),
$definition
);
} }
} }
...@@ -1627,7 +1630,7 @@ abstract class AbstractPlatform ...@@ -1627,7 +1630,7 @@ abstract class AbstractPlatform
if (isset($options['indexes']) && ! empty($options['indexes'])) { if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] as $index => $definition) { foreach ($options['indexes'] as $index => $definition) {
$columnListSql .= ', ' . $this->getIndexDeclarationSQL($index, $definition); $columnListSql .= ', ' . $this->getIndexDeclarationSQL($definition->getQuotedName($this), $definition);
} }
} }
...@@ -2313,7 +2316,7 @@ abstract class AbstractPlatform ...@@ -2313,7 +2316,7 @@ abstract class AbstractPlatform
throw new \InvalidArgumentException("Incomplete definition. 'columns' required."); throw new \InvalidArgumentException("Incomplete definition. 'columns' required.");
} }
return 'CONSTRAINT ' . $name . ' UNIQUE (' return 'CONSTRAINT ' . $index->getQuotedName($this) . ' UNIQUE ('
. $this->getIndexFieldDeclarationListSQL($columns) . $this->getIndexFieldDeclarationListSQL($columns)
. ')' . $this->getPartialIndexSQL($index); . ')' . $this->getPartialIndexSQL($index);
} }
...@@ -2337,7 +2340,7 @@ abstract class AbstractPlatform ...@@ -2337,7 +2340,7 @@ abstract class AbstractPlatform
throw new \InvalidArgumentException("Incomplete definition. 'columns' required."); throw new \InvalidArgumentException("Incomplete definition. 'columns' required.");
} }
return $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $name . ' (' return $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $index->getQuotedName($this) . ' ('
. $this->getIndexFieldDeclarationListSQL($columns) . $this->getIndexFieldDeclarationListSQL($columns)
. ')' . $this->getPartialIndexSQL($index); . ')' . $this->getPartialIndexSQL($index);
} }
......
...@@ -392,14 +392,14 @@ class MySqlPlatform extends AbstractPlatform ...@@ -392,14 +392,14 @@ class MySqlPlatform extends AbstractPlatform
if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) { if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
foreach ($options['uniqueConstraints'] as $index => $definition) { foreach ($options['uniqueConstraints'] as $index => $definition) {
$queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($definition->getQuotedName($this), $definition); $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition);
} }
} }
// add all indexes // add all indexes
if (isset($options['indexes']) && ! empty($options['indexes'])) { if (isset($options['indexes']) && ! empty($options['indexes'])) {
foreach ($options['indexes'] as $index => $definition) { foreach ($options['indexes'] as $index => $definition) {
$queryFields .= ', ' . $this->getIndexDeclarationSQL($definition->getQuotedName($this), $definition); $queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
} }
} }
......
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