Permalink
Browse files

[DBAL-42] MySQLPlatform::getAlterTableSQL() with regard with Doctrine…

… Type Detection.
  • Loading branch information...
1 parent 30458e8 commit 18bed8f2e1d6cccb534dd0150f3d06d1bd781f55 @beberlei beberlei committed Feb 20, 2011
Showing with 9 additions and 3 deletions.
  1. +9 −3 lib/Doctrine/DBAL/Platforms/MySqlPlatform.php
@@ -422,7 +422,9 @@ public function getAlterTableSQL(TableDiff $diff)
}
foreach ($diff->addedColumns AS $fieldName => $column) {
- $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
foreach ($diff->removedColumns AS $column) {
@@ -432,13 +434,17 @@ public function getAlterTableSQL(TableDiff $diff)
foreach ($diff->changedColumns AS $columnDiff) {
/* @var $columnDiff Doctrine\DBAL\Schema\ColumnDiff */
$column = $columnDiff->column;
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
$queryParts[] = 'CHANGE ' . ($columnDiff->oldColumnName) . ' '
- . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
foreach ($diff->renamedColumns AS $oldColumnName => $column) {
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
$queryParts[] = 'CHANGE ' . $oldColumnName . ' '
- . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
}
$sql = array();

0 comments on commit 18bed8f

Please sign in to comment.