diff --git a/src/Platforms/AbstractMySQLPlatform.php b/src/Platforms/AbstractMySQLPlatform.php index 261859c039a..728b463aebd 100644 --- a/src/Platforms/AbstractMySQLPlatform.php +++ b/src/Platforms/AbstractMySQLPlatform.php @@ -667,7 +667,7 @@ public function getAlterTableSQL(TableDiff $diff) $oldColumn = $columnDiff->getOldColumn() ?? $columnDiff->getOldColumnName(); $oldColumnName = $oldColumn->getName(); - if ($columnDiff->hasNameChanged($this)) { + if ($columnDiff->hasNameChanged()) { if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $newColumn, $diff, $columnSql)) { continue; } diff --git a/src/Platforms/AbstractPlatform.php b/src/Platforms/AbstractPlatform.php index f97110e3013..c1b18d6839f 100644 --- a/src/Platforms/AbstractPlatform.php +++ b/src/Platforms/AbstractPlatform.php @@ -4679,12 +4679,4 @@ public function createSchemaManager(Connection $connection): AbstractSchemaManag { throw Exception::notSupported(__METHOD__); } - - /** - * Determines if this platform's column names are case sensitive or not (most of them are not). - */ - public function areColumnNamesCaseSensitive(): bool - { - return false; - } } diff --git a/src/Platforms/DB2Platform.php b/src/Platforms/DB2Platform.php index 88cc65b2de5..4f97f37f4d5 100644 --- a/src/Platforms/DB2Platform.php +++ b/src/Platforms/DB2Platform.php @@ -637,7 +637,7 @@ public function getAlterTableSQL(TableDiff $diff) $oldColumnName = $oldColumn->getQuotedName($this); - if ($columnDiff->hasNameChanged($this)) { + if ($columnDiff->hasNameChanged()) { if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $newColumn, $diff, $columnSql)) { continue; } @@ -773,7 +773,7 @@ private function getAlterColumnClausesSQL(ColumnDiff $columnDiff): array $clauses = []; - if ($columnDiff->hasNameChanged($this)) { + if ($columnDiff->hasNameChanged()) { $clauses[] = 'RENAME COLUMN ' . $oldName . ' TO ' . $newName; } diff --git a/src/Platforms/OraclePlatform.php b/src/Platforms/OraclePlatform.php index 8008a93d92e..eb9b2b36b76 100644 --- a/src/Platforms/OraclePlatform.php +++ b/src/Platforms/OraclePlatform.php @@ -905,7 +905,7 @@ public function getAlterTableSQL(TableDiff $diff) $oldColumnName = $oldColumn->getQuotedName($this); // Column names in Oracle are case insensitive and automatically uppercased on the server. - if ($columnDiff->hasNameChanged($this)) { + if ($columnDiff->hasNameChanged()) { if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $newColumn, $diff, $columnSql)) { continue; } diff --git a/src/Platforms/PostgreSQLPlatform.php b/src/Platforms/PostgreSQLPlatform.php index 8feb74c4dd0..a78fce4dd55 100644 --- a/src/Platforms/PostgreSQLPlatform.php +++ b/src/Platforms/PostgreSQLPlatform.php @@ -573,7 +573,7 @@ public function getAlterTableSQL(TableDiff $diff) $oldColumnName = $oldColumn->getQuotedName($this); $newColumnName = $newColumn->getQuotedName($this); - if ($columnDiff->hasNameChanged($this)) { + if ($columnDiff->hasNameChanged()) { if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $newColumn, $diff, $columnSql)) { continue; } @@ -1398,9 +1398,4 @@ public function createSchemaManager(Connection $connection): PostgreSQLSchemaMan { return new PostgreSQLSchemaManager($connection, $this); } - - public function areColumnNamesCaseSensitive(): bool - { - return true; - } } diff --git a/src/Platforms/SQLServerPlatform.php b/src/Platforms/SQLServerPlatform.php index 0c4482d0461..b59885eeac6 100644 --- a/src/Platforms/SQLServerPlatform.php +++ b/src/Platforms/SQLServerPlatform.php @@ -568,7 +568,7 @@ public function getAlterTableSQL(TableDiff $diff) $oldColumn = $columnDiff->getOldColumn() ?? $columnDiff->getOldColumnName(); $oldColumnName = $oldColumn->getQuotedName($this); - $nameChanged = $columnDiff->hasNameChanged($this); + $nameChanged = $columnDiff->hasNameChanged(); // Column names in SQL server are case insensitive and automatically uppercased on the server. if ($nameChanged) { @@ -776,7 +776,7 @@ private function alterColumnRequiresDropDefaultConstraint(ColumnDiff $columnDiff // We need to drop an existing default constraint if the column was // defined with a default value before and the native column type has changed. - return $columnDiff->hasTypeChanged() || $columnDiff->hasFixedChanged() || $columnDiff->hasNameChanged($this); + return $columnDiff->hasTypeChanged() || $columnDiff->hasFixedChanged() || $columnDiff->hasNameChanged(); } /** diff --git a/src/Platforms/SqlitePlatform.php b/src/Platforms/SqlitePlatform.php index 32b41856db5..20984d7776b 100644 --- a/src/Platforms/SqlitePlatform.php +++ b/src/Platforms/SqlitePlatform.php @@ -1046,7 +1046,7 @@ public function getAlterTableSQL(TableDiff $diff) $oldColumnName = strtolower($oldColumn->getName()); - if ($columnDiff->hasNameChanged($this)) { + if ($columnDiff->hasNameChanged()) { if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $newColumn, $diff, $columnSql)) { continue; } diff --git a/src/Schema/ColumnDiff.php b/src/Schema/ColumnDiff.php index 59549458623..8e692bd2e70 100644 --- a/src/Schema/ColumnDiff.php +++ b/src/Schema/ColumnDiff.php @@ -80,14 +80,12 @@ public function getNewColumn(): Column return $this->column; } - public function hasNameChanged(AbstractPlatform $platform): bool + public function hasNameChanged(): bool { $oldColumn = $this->getOldColumn() ?? $this->getOldColumnName(); // Column names are case insensitive - return $platform->areColumnNamesCaseSensitive() - ? $oldColumn->getName() !== $this->getNewColumn()->getName() - : strcasecmp($oldColumn->getName(), $this->getNewColumn()->getName()) !== 0; + return strcasecmp($oldColumn->getName(), $this->getNewColumn()->getName()) !== 0; } public function hasTypeChanged(): bool diff --git a/tests/Schema/TableTest.php b/tests/Schema/TableTest.php index 989b4e50e71..d72eaa72cad 100644 --- a/tests/Schema/TableTest.php +++ b/tests/Schema/TableTest.php @@ -82,7 +82,7 @@ public function testRenameColumnException(): void $this->expectExceptionMessage("You are trying to rename the column baz but you didn't change it's name"); $table = new Table('foo'); - $table->renameColumn('baz', 'baz'); + $table->renameColumn('baz', 'Baz'); } public function testColumnsCaseInsensitive(): void