Commit 30458e8a authored by Benjamin Eberlei's avatar Benjamin Eberlei

[DBAL-42] Fix ALTER TABLE with Comments for Oracle and PostgreSQL.

parent 6e0bf10e
...@@ -506,8 +506,8 @@ LEFT JOIN all_cons_columns r_cols ...@@ -506,8 +506,8 @@ LEFT JOIN all_cons_columns r_cols
$fields = array(); $fields = array();
foreach ($diff->addedColumns AS $column) { foreach ($diff->addedColumns AS $column) {
$fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); $fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
if ($column->getComment()) { if ($comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $this->getColumnComment($column)); $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
} }
} }
if (count($fields)) { if (count($fields)) {
...@@ -518,8 +518,8 @@ LEFT JOIN all_cons_columns r_cols ...@@ -518,8 +518,8 @@ LEFT JOIN all_cons_columns r_cols
foreach ($diff->changedColumns AS $columnDiff) { foreach ($diff->changedColumns AS $columnDiff) {
$column = $columnDiff->column; $column = $columnDiff->column;
$fields[] = $column->getQuotedName($this). ' ' . $this->getColumnDeclarationSQL('', $column->toArray()); $fields[] = $column->getQuotedName($this). ' ' . $this->getColumnDeclarationSQL('', $column->toArray());
if ($columnDiff->hasChanged('comment') && $column->getComment()) { if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $this->getColumnComment($column)); $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
} }
} }
if (count($fields)) { if (count($fields)) {
......
...@@ -353,8 +353,8 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -353,8 +353,8 @@ class PostgreSqlPlatform extends AbstractPlatform
foreach ($diff->addedColumns as $column) { foreach ($diff->addedColumns as $column) {
$query = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray()); $query = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
$sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query; $sql[] = 'ALTER TABLE ' . $diff->name . ' ' . $query;
if ($column->getComment()) { if ($comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $this->getColumnComment($column)); $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
} }
} }
...@@ -397,8 +397,8 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -397,8 +397,8 @@ class PostgreSqlPlatform extends AbstractPlatform
$sql[] = "ALTER TABLE " . $diff->name . " " . $query; $sql[] = "ALTER TABLE " . $diff->name . " " . $query;
} }
} }
if ($columnDiff->hasChanged('comment') && $column->getComment()) { if ($columnDiff->hasChanged('comment') && $comment = $this->getColumnComment($column)) {
$commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $this->getColumnComment($column)); $commentsSQL[] = $this->getCommentOnColumnSQL($diff->name, $column->getName(), $comment);
} }
} }
......
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