Skip to content

Commit

Permalink
fix(PostgreSQL omit dropped columns in getListTableColumnsSQL (pg_att…
Browse files Browse the repository at this point in the history
…ribute table) to avoid ........pg.dropped.x....... - test fix

Signed-off-by: Kamil Michalak <[email protected]>
  • Loading branch information
kamil-michalak committed Dec 22, 2023
1 parent 57c68c3 commit dbf2b62
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/Functional/TableDropColumnTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit dbf2b62

Please sign in to comment.