diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index 49e131552ba..928a5a02121 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -4693,6 +4693,11 @@ public function columnsEqual(Column $column1, Column $column2): bool return false; } + // If disableTypeComments is true, we do not need to check types, all comparison is already done above + if ($this->disableTypeComments) { + return true; + } + return $column1->getType() === $column2->getType(); } diff --git a/tests/Platforms/AbstractPlatformTestCase.php b/tests/Platforms/AbstractPlatformTestCase.php index feabb6eb384..a6e998b244d 100644 --- a/tests/Platforms/AbstractPlatformTestCase.php +++ b/tests/Platforms/AbstractPlatformTestCase.php @@ -1445,6 +1445,18 @@ public function testEmptySchemaDiff(): void self::assertSame([], $this->platform->getAlterSchemaSQL($diff)); } + public function testColumnComparison(): void + { + //Since DATETIME_MUTABLE is a "parent" of DATETIME_IMMUTABLE, they will have the same SQL type declaration. + $column1 = new Column('foo', Type::getType(Types::DATETIME_MUTABLE)); + $column2 = new Column('foo', Type::getType(Types::DATETIME_IMMUTABLE)); + + self::assertFalse($this->platform->columnsEqual($column1, $column2)); + + $this->platform->setDisableTypeComments(true); + self::assertTrue($this->platform->columnsEqual($column1, $column2)); + } + public function tearDown(): void { if (! isset($this->backedUpType)) {