Skip to content

Commit e9a7be9

Browse files
committed
Do not use ColumnDiff::$changedProperties in PostgreSQLPlatform::getAlterTableSQL()
1 parent f84b9d9 commit e9a7be9

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

src/Platforms/PostgreSQLPlatform.php

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,18 @@
77
use Doctrine\DBAL\Connection;
88
use Doctrine\DBAL\Platforms\Keywords\KeywordList;
99
use Doctrine\DBAL\Platforms\Keywords\PostgreSQLKeywords;
10-
use Doctrine\DBAL\Schema\ColumnDiff;
1110
use Doctrine\DBAL\Schema\ForeignKeyConstraint;
1211
use Doctrine\DBAL\Schema\Identifier;
1312
use Doctrine\DBAL\Schema\Index;
1413
use Doctrine\DBAL\Schema\PostgreSQLSchemaManager;
1514
use Doctrine\DBAL\Schema\Sequence;
1615
use Doctrine\DBAL\Schema\TableDiff;
1716
use Doctrine\DBAL\TransactionIsolationLevel;
18-
use Doctrine\DBAL\Types\BinaryType;
19-
use Doctrine\DBAL\Types\BlobType;
2017
use UnexpectedValueException;
2118

22-
use function array_diff;
2319
use function array_merge;
2420
use function array_unique;
2521
use function array_values;
26-
use function count;
2722
use function explode;
2823
use function implode;
2924
use function in_array;
@@ -265,10 +260,6 @@ public function getAlterTableSQL(TableDiff $diff): array
265260
continue;
266261
}
267262

268-
if ($this->isUnchangedBinaryColumn($columnDiff)) {
269-
continue;
270-
}
271-
272263
$fromColumn = $columnDiff->fromColumn;
273264

274265
$oldColumnName = $fromColumn->getQuotedName($this);
@@ -372,32 +363,6 @@ public function getAlterTableSQL(TableDiff $diff): array
372363
return array_merge($sql, $tableSql, $columnSql);
373364
}
374365

375-
/**
376-
* Checks whether a given column diff is a logically unchanged binary type column.
377-
*
378-
* Used to determine whether a column alteration for a binary type column can be skipped.
379-
* Doctrine's {@see BinaryType} and {@see BlobType} are mapped to the same database column type on this platform
380-
* as this platform does not have a native VARBINARY/BINARY column type. Therefore the comparator
381-
* might detect differences for binary type columns which do not have to be propagated
382-
* to database as there actually is no difference at database level.
383-
*/
384-
private function isUnchangedBinaryColumn(ColumnDiff $columnDiff): bool
385-
{
386-
$columnType = $columnDiff->column->getType();
387-
388-
if (! $columnType instanceof BinaryType && ! $columnType instanceof BlobType) {
389-
return false;
390-
}
391-
392-
$fromColumnType = $columnDiff->fromColumn->getType();
393-
394-
if (! $fromColumnType instanceof BinaryType && ! $fromColumnType instanceof BlobType) {
395-
return false;
396-
}
397-
398-
return count(array_diff($columnDiff->changedProperties, ['type', 'length', 'fixed'])) === 0;
399-
}
400-
401366
/**
402367
* {@inheritdoc}
403368
*/

0 commit comments

Comments
 (0)