Commit 7195d201 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Merge branch 'DBAL-585' into 2.4

parents 8be725c4 585672e8
...@@ -391,7 +391,7 @@ class DB2Platform extends AbstractPlatform ...@@ -391,7 +391,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());
} }
......
...@@ -410,7 +410,7 @@ class DrizzlePlatform extends AbstractPlatform ...@@ -410,7 +410,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);
} }
......
...@@ -418,7 +418,7 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -418,7 +418,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);
}
} }
...@@ -494,4 +494,24 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase ...@@ -494,4 +494,24 @@ abstract class AbstractPlatformTestCase extends \Doctrine\Tests\DbalTestCase
$sql = $this->_platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS); $sql = $this->_platform->getCreateTableSQL($table, AbstractPlatform::CREATE_FOREIGNKEYS);
$this->assertEquals($this->getQuotedColumnInForeignKeySQL(), $sql); $this->assertEquals($this->getQuotedColumnInForeignKeySQL(), $sql);
} }
/**
* @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