Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix db drop and schema create commands with default_dbname option #1784

Merged
merged 1 commit into from
Mar 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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';

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

View check run for this annotation

Codecov / codecov/patch

src/Command/CreateDatabaseDoctrineCommand.php#L70

Added line #L70 was not covered by tests
}

$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 @@
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';

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

View check run for this annotation

Codecov / codecov/patch

src/Command/DropDatabaseDoctrineCommand.php#L81

Added line #L81 was not covered by tests
}

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