From dbf2b628ab7eff4450e67578fa9ad0e173058d81 Mon Sep 17 00:00:00 2001 From: Kamil Michalak Date: Fri, 22 Dec 2023 18:15:11 +0000 Subject: [PATCH] fix(PostgreSQL omit dropped columns in getListTableColumnsSQL (pg_attribute table) to avoid ........pg.dropped.x....... - test fix Signed-off-by: Kamil Michalak --- tests/Functional/TableDropColumnTest.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/Functional/TableDropColumnTest.php b/tests/Functional/TableDropColumnTest.php index fea8dca6b1b..9947bb33426 100644 --- a/tests/Functional/TableDropColumnTest.php +++ b/tests/Functional/TableDropColumnTest.php @@ -19,11 +19,20 @@ protected function setUp(): void $table->addColumn('test_column1', Types::STRING); $table->addColumn('test_column2', Types::INTEGER); $table->setPrimaryKey(['id']); - $table->addIndex(['test_column1', 'test_column2']); + + $platform = $this->connection->getDatabasePlatform(); + + $table->addIndex(['test_column1', 'test_column2'], 'test'); $this->dropAndCreateTable($table); - $this->connection->executeStatement('ALTER TABLE write_table DROP COLUMN test_column1'); + // some db engine dont allow drop column which belongs to index but on pgsql it leave pg_attribute with attisdropped=true so we can test it + try { + $this->connection->executeStatement('ALTER TABLE write_table DROP COLUMN test_column1'); + } catch (Throwable $e) { + $table->dropIndex('test'); + $this->connection->executeStatement('ALTER TABLE write_table DROP COLUMN test_column1'); + } } public function testPgSqlPgAttributeTable(): void