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 23, 2024
1 parent 7f209ad commit 6ff4c0b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Command/CreateDatabaseDoctrineCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
unset($params['dbname'], $params['path'], $params['url']);

if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
$params['dbname'] = 'postgres';
$params['dbname'] = $params['default_dbname'] ?? 'postgres';

Check failure on line 69 in src/Command/CreateDatabaseDoctrineCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm

InvalidArrayOffset

src/Command/CreateDatabaseDoctrineCommand.php:69:33: InvalidArrayOffset: Cannot access value on variable $params using offset value of 'default_dbname', expecting 'application_name', 'charset', 'defaultTableOptions', 'driver', 'driverClass', 'driverOptions', 'host', 'keepReplica', 'memory', 'password', 'persistent', 'port', 'primary', 'replica', 'serverVersion', 'sessionMode', 'user', 'wrapperClass' or 'unix_socket' (see https://psalm.dev/115)

Check warning on line 69 in src/Command/CreateDatabaseDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

src/Command/CreateDatabaseDoctrineCommand.php#L69

Added line #L69 was not covered by tests
}

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

if ($connection->getDatabasePlatform() instanceof PostgreSQLPlatform) {
$params['dbname'] = 'postgres';
$params['dbname'] = $params['default_dbname'] ?? 'postgres';

Check failure on line 80 in src/Command/DropDatabaseDoctrineCommand.php

View workflow job for this annotation

GitHub Actions / Static Analysis with Psalm

InvalidArrayOffset

src/Command/DropDatabaseDoctrineCommand.php:80:33: InvalidArrayOffset: Cannot access value on variable $params using offset value of 'default_dbname', expecting 'application_name', 'charset', 'defaultTableOptions', 'driver', 'driverClass', 'driverOptions', 'host', 'keepReplica', 'memory', 'password', 'path', 'persistent', 'port', 'primary', 'replica', 'serverVersion', 'sessionMode', 'user', 'wrapperClass' or 'unix_socket' (see https://psalm.dev/115)

Check warning on line 80 in src/Command/DropDatabaseDoctrineCommand.php

View check run for this annotation

Codecov / codecov/patch

src/Command/DropDatabaseDoctrineCommand.php#L80

Added line #L80 was not covered by tests
}

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

0 comments on commit 6ff4c0b

Please sign in to comment.