Skip to content

Commit f282cc3

Browse files
committed
Fix db drop and schema create commands with default_dbname option
Fixes #1783
1 parent 6d3aa61 commit f282cc3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Command/CreateDatabaseDoctrineCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6666
unset($params['dbname'], $params['path'], $params['url']);
6767

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

7273
$tmpConnection = DriverManager::getConnection($params, $connection->getConfiguration());

src/Command/DropDatabaseDoctrineCommand.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7777
unset($params['dbname'], $params['url']);
7878

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

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

0 commit comments

Comments
 (0)