Commit c40a24f7 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-585'

parents a92784a1 5156391b
...@@ -477,7 +477,7 @@ class DB2Platform extends AbstractPlatform ...@@ -477,7 +477,7 @@ class DB2Platform extends AbstractPlatform
/* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column; $column = $columnDiff->column;
$queryParts[] = 'ALTER ' . ($columnDiff->oldColumnName) . ' ' $queryParts[] = 'ALTER ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' '
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
} }
......
...@@ -426,7 +426,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -426,7 +426,7 @@ class DrizzlePlatform extends AbstractPlatform
$column = $columnDiff->column; $column = $columnDiff->column;
$columnArray = $column->toArray(); $columnArray = $column->toArray();
$columnArray['comment'] = $this->getColumnComment($column); $columnArray['comment'] = $this->getColumnComment($column);
$queryParts[] = 'CHANGE ' . ($columnDiff->oldColumnName) . ' ' $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' '
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
} }
......
...@@ -557,7 +557,7 @@ class MySqlPlatform extends AbstractPlatform ...@@ -557,7 +557,7 @@ class MySqlPlatform extends AbstractPlatform
$column = $columnDiff->column; $column = $columnDiff->column;
$columnArray = $column->toArray(); $columnArray = $column->toArray();
$columnArray['comment'] = $this->getColumnComment($column); $columnArray['comment'] = $this->getColumnComment($column);
$queryParts[] = 'CHANGE ' . ($columnDiff->oldColumnName) . ' ' $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' '
. $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
} }
......
...@@ -442,7 +442,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -442,7 +442,7 @@ class PostgreSqlPlatform extends AbstractPlatform
continue; continue;
} }
$oldColumnName = $columnDiff->oldColumnName; $oldColumnName = $columnDiff->getOldColumnName()->getQuotedName($this);
$column = $columnDiff->column; $column = $columnDiff->column;
if ($columnDiff->hasChanged('type') || $columnDiff->hasChanged('precision') || $columnDiff->hasChanged('scale')) { if ($columnDiff->hasChanged('type') || $columnDiff->hasChanged('precision') || $columnDiff->hasChanged('scale')) {
......
...@@ -71,4 +71,12 @@ class ColumnDiff ...@@ -71,4 +71,12 @@ class ColumnDiff
{ {
return in_array($propertyName, $this->changedProperties); return in_array($propertyName, $this->changedProperties);
} }
/**
* @return \Doctrine\DBAL\Schema\Identifier
*/
public function getOldColumnName()
{
return new Identifier($this->oldColumnName);
}
} }
...@@ -510,4 +510,24 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -510,4 +510,24 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
{ {
$this->_platform->schemaNeedsCreation('schema'); $this->_platform->schemaNeedsCreation('schema');
} }
/**
* @group DBAL-585
*/
public function testAlterTableChangeQuotedColumn()
{
$tableDiff = new \Doctrine\DBAL\Schema\TableDiff('mytable');
$tableDiff->fromTable = new \Doctrine\DBAL\Schema\Table('mytable');
$tableDiff->changedColumns['foo'] = new \Doctrine\DBAL\Schema\ColumnDiff(
'select', new \Doctrine\DBAL\Schema\Column(
'select', \Doctrine\DBAL\Types\Type::getType('string')
),
array('type')
);
$this->assertContains(
$this->_platform->quoteIdentifier('select'),
implode(';', $this->_platform->getAlterTableSQL($tableDiff))
);
}
} }
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