From 32d21c21ff331c5e260c091047946d33cfdc8a49 Mon Sep 17 00:00:00 2001 From: Kamil Michalak Date: Fri, 22 Dec 2023 18:30:08 +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, 5 insertions(+), 8 deletions(-) diff --git a/tests/Functional/TableDropColumnTest.php b/tests/Functional/TableDropColumnTest.php index 9947bb33426..a0942d2b86b 100644 --- a/tests/Functional/TableDropColumnTest.php +++ b/tests/Functional/TableDropColumnTest.php @@ -22,17 +22,14 @@ protected function setUp(): void $platform = $this->connection->getDatabasePlatform(); - $table->addIndex(['test_column1', 'test_column2'], 'test'); + // some db engines dont allow drop column which belongs to index but on pgsql it leave pg_attribute with attisdropped=true so we can test it + if ($platform instanceof PostgreSQLPlatform) { + $table->addIndex(['test_column1', 'test_column2'], 'test'); + } $this->dropAndCreateTable($table); - // 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'); - } + $this->connection->executeStatement('ALTER TABLE write_table DROP COLUMN test_column1'); } public function testPgSqlPgAttributeTable(): void