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