Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #401 from KingCrunch/fix-command

Compare with dbname with existing databases needs unquoted dbname
  • Loading branch information...
commit 3bf42bf13d1bd010cda573e9309bc6a10d9c0d43 2 parents 8a88020 + a022e82
@guilhermeblanco guilhermeblanco authored
View
5 Command/CreateDatabaseDoctrineCommand.php
@@ -71,6 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
unset($params['dbname']);
$tmpConnection = DriverManager::getConnection($params);
+ $shouldNotCreateDatabase = $ifNotExists && in_array($name, $tmpConnection->getSchemaManager()->listDatabases());
// Only quote if we don't have a path
if (!isset($params['path'])) {
@@ -79,10 +80,8 @@ protected function execute(InputInterface $input, OutputInterface $output)
$error = false;
try {
- $shouldNotCreateDatabase = $ifNotExists && in_array($name, $tmpConnection->getSchemaManager()->listDatabases());
-
if ($shouldNotCreateDatabase) {
- $output->writeln(sprintf('<info>Database for connection named <comment>%s</comment> already exists. Skipped.</info>'));
+ $output->writeln(sprintf('<info>Database for connection named <comment>%s</comment> already exists. Skipped.</info>', $name));
} else {
$tmpConnection->getSchemaManager()->createDatabase($name);
$output->writeln(sprintf('<info>Created database for connection named <comment>%s</comment></info>', $name));
View
3  Command/DropDatabaseDoctrineCommand.php
@@ -85,6 +85,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
// as some vendors do not allow dropping the database connected to.
$connection->close();
$connection = DriverManager::getConnection($params);
+ $shouldDropDatabase = !$ifExists || in_array($name, $connection->getSchemaManager()->listDatabases());
// Only quote if we don't have a path
if (!isset($params['path'])) {
@@ -92,8 +93,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
try {
- $shouldDropDatabase = !$ifExists || in_array($name, $connection->getSchemaManager()->listDatabases());
-
if ($shouldDropDatabase) {
$connection->getSchemaManager()->dropDatabase($name);
$output->writeln(sprintf('<info>Dropped database for connection named <comment>%s</comment></info>', $name));
Please sign in to comment.
Something went wrong with that request. Please try again.