Skip to content

Commit

Permalink
Add workaround for doctrine/dbal#5369
Browse files Browse the repository at this point in the history
  • Loading branch information
flack committed Aug 11, 2022
1 parent c365d88 commit 1a7141d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/command/schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ private function generate_proxyfiles(array $cms)
public static function diff(dbal_schema $from, dbal_schema $to, bool $delete = false) : SchemaDiff
{
$platform = connection::get_em()->getConnection()->getDatabasePlatform();
$diff = (new Comparator($platform))->compareSchemas($from, $to);
$comparator = new Comparator($platform);
$diff = $comparator->compareSchemas($from, $to);

foreach ($diff->changedTables as $changed_table) {
if (!empty($changed_table->renamedColumns)) {
Expand All @@ -160,6 +161,12 @@ public static function diff(dbal_schema $from, dbal_schema $to, bool $delete = f
if (!$delete) {
$changed_table->removedColumns = [];
}
// workaround for https://github.com/doctrine/dbal/issues/5369
foreach ($changed_table->changedColumns as $name => $col_diff) {
if (!$comparator->diffColumn($col_diff->column, $col_diff->fromColumn)) {
unset($changed_table->changedColumns[$name]);
}
}
}
return $diff;
}
Expand Down

0 comments on commit 1a7141d

Please sign in to comment.