Commit 75d35f58 authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-555] Improved approach to fix issue from GH-367.

parent 2c1f6d71
......@@ -527,7 +527,7 @@ class MySqlPlatform extends AbstractPlatform
$columnSql = array();
$queryParts = array();
if ($diff->newName !== false) {
$queryParts[] = 'RENAME TO ' . $diff->newName;
$queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this);
}
foreach ($diff->addedColumns as $column) {
......@@ -583,7 +583,7 @@ class MySqlPlatform extends AbstractPlatform
if ( ! $this->onSchemaAlterTable($diff, $tableSql)) {
if (count($queryParts) > 0) {
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . implode(", ", $queryParts);
$sql[] = 'ALTER TABLE ' . $diff->getName()->getQuotedName($this) . ' ' . implode(", ", $queryParts);
}
$sql = array_merge(
$this->getPreAlterTableIndexForeignKeySQL($diff),
......@@ -601,7 +601,7 @@ class MySqlPlatform extends AbstractPlatform
protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
{
$sql = array();
$table = $diff->name;
$table = $diff->getName()->getQuotedName($this);
foreach ($diff->removedIndexes as $remKey => $remIndex) {
// Dropping primary keys requires to unset autoincrement attribute on the particular column first.
......
......@@ -138,4 +138,14 @@ class TableDiff
$this->removedIndexes = $removedIndexes;
$this->fromTable = $fromTable;
}
public function getName()
{
return new Identifier($this->name);
}
public function getNewName()
{
return new Identifier($this->newName);
}
}
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