diff --git a/src/Platforms/SqlitePlatform.php b/src/Platforms/SqlitePlatform.php index b4709721eb1..db51b682624 100644 --- a/src/Platforms/SqlitePlatform.php +++ b/src/Platforms/SqlitePlatform.php @@ -1016,7 +1016,7 @@ public function getAlterTableSQL(TableDiff $diff) private function replaceColumn($tableName, array $columns, $columnName, Column $column): array { $keys = array_keys($columns); - $index = array_search($columnName, $keys, true); + $index = array_search(strtolower($columnName), $keys, true); if ($index === false) { throw SchemaException::columnDoesNotExist($columnName, $tableName); diff --git a/src/Schema/SqliteSchemaManager.php b/src/Schema/SqliteSchemaManager.php index 94529e2557f..1895fc4e1dd 100644 --- a/src/Schema/SqliteSchemaManager.php +++ b/src/Schema/SqliteSchemaManager.php @@ -577,4 +577,13 @@ public function createComparator(): Comparator { return new SQLite\Comparator($this->getDatabasePlatform()); } + + /** + * {@inheritDoc} + */ + public function getSchemaSearchPaths() + { + // SQLite does not support schemas or databases + return []; + } } diff --git a/tests/Functional/Platform/RenameColumnTest.php b/tests/Functional/Platform/RenameColumnTest.php index fea9a2e25fd..4cc9ccb667f 100644 --- a/tests/Functional/Platform/RenameColumnTest.php +++ b/tests/Functional/Platform/RenameColumnTest.php @@ -10,16 +10,23 @@ class RenameColumnTest extends FunctionalTestCase { - public function testColumnPositionRetainedAfterRenaming(): void + /** + * @dataProvider columnNameProvider + */ + public function testColumnPositionRetainedAfterRenaming(string $columnName): void { + if ($columnName === 'C1') { + self::markTestIncomplete('See https://github.com/doctrine/dbal/issues/4816'); + } + $table = new Table('test_rename'); - $table->addColumn('c1', 'string'); + $table->addColumn($columnName, 'string'); $table->addColumn('c2', 'integer'); $sm = $this->connection->createSchemaManager(); $sm->dropAndCreateTable($table); - $table->dropColumn('c1') + $table->dropColumn($columnName) ->addColumn('c1_x', 'string'); $comparator = new Comparator(); @@ -31,4 +38,13 @@ public function testColumnPositionRetainedAfterRenaming(): void $table = $sm->listTableDetails('test_rename'); self::assertSame(['c1_x', 'c2'], array_keys($table->getColumns())); } + + /** + * @return iterable + */ + public static function columnNameProvider(): iterable + { + yield ['c1']; + yield ['C1']; + } } diff --git a/tests/Functional/Schema/SchemaTest.php b/tests/Functional/Schema/SchemaTest.php new file mode 100644 index 00000000000..c4241268f45 --- /dev/null +++ b/tests/Functional/Schema/SchemaTest.php @@ -0,0 +1,17 @@ +connection->createSchemaManager()->createSchemaConfig()); + self::assertNotEmpty($schema->getName()); + } +}