Skip to content

Commit

Permalink
Fix db drop and schema create commands with default_dbname option
Browse files Browse the repository at this point in the history
Fixes #1783
  • Loading branch information
ostrolucky committed Mar 24, 2024
1 parent 6d3aa61 commit f282cc3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Command/CreateDatabaseDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
unset($params['dbname'], $params['path'], $params['url']);

if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
$params['dbname'] = 'postgres';
/** @psalm-suppress InvalidArrayOffset It's still available in DBAL 3.x that we need to support */
$params['dbname'] = $params['default_dbname'] ?? 'postgres';
}

$tmpConnection = DriverManager::getConnection($params, $connection->getConfiguration());
Expand Down
3 changes: 2 additions & 1 deletion src/Command/DropDatabaseDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
unset($params['dbname'], $params['url']);

if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
$params['dbname'] = 'postgres';
/** @psalm-suppress InvalidArrayOffset It's still available in DBAL 3.x that we need to support */
$params['dbname'] = $params['default_dbname'] ?? 'postgres';
}

if (! $input->getOption('force')) {
Expand Down

0 comments on commit f282cc3

Please sign in to comment.