Unverified Commit 6ce2ef72 authored by Ben Davies's avatar Ben Davies Committed by Sergei Morozov

refactor out getting old column comment

parent 1b7abb4b
...@@ -591,11 +591,8 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -591,11 +591,8 @@ class PostgreSqlPlatform extends AbstractPlatform
} }
} }
$oldComment = null;
$newComment = $this->getColumnComment($column); $newComment = $this->getColumnComment($column);
if (null !== $columnDiff->fromColumn) { $oldComment = $this->getOldColumnComment($columnDiff);
$oldComment = $this->getColumnComment($columnDiff->fromColumn);
}
if ($columnDiff->hasChanged('comment') || ($columnDiff->fromColumn !== null && $oldComment !== $newComment)) { if ($columnDiff->hasChanged('comment') || ($columnDiff->fromColumn !== null && $oldComment !== $newComment)) {
$commentsSQL[] = $this->getCommentOnColumnSQL( $commentsSQL[] = $this->getCommentOnColumnSQL(
...@@ -1260,4 +1257,9 @@ class PostgreSqlPlatform extends AbstractPlatform ...@@ -1260,4 +1257,9 @@ class PostgreSqlPlatform extends AbstractPlatform
{ {
return $type instanceof IntegerType || $type instanceof BigIntType; return $type instanceof IntegerType || $type instanceof BigIntType;
} }
private function getOldColumnComment(ColumnDiff $columnDiff) : ?string
{
return $columnDiff->fromColumn ? $this->getColumnComment($columnDiff->fromColumn) : null;
}
} }
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