Bug corrected when the database has no table in the command table:drop

This commit is contained in:
Maxime AILLOUD 2011-07-07 16:13:45 +02:00 committed by William DURAND
parent 5a1f644a6a
commit f74c659f24

View file

@ -93,10 +93,17 @@ EOT
$tablesToDelete = join(', ', $tablesToDelete);
$dropStatement = $connection->prepare('DROP TABLE ' . $tablesToDelete . ' ;');
$dropStatement->execute();
if ($tablesToDelete != '')
{
$dropStatement = $connection->prepare('DROP TABLE ' . $tablesToDelete . ' ;');
$dropStatement->execute();
$output->writeln(sprintf('Table' . $tablePlural . ' <info><comment>%s</comment> has been dropped.</info>', $tablesToDelete));
$output->writeln(sprintf('Table' . $tablePlural . ' <info><comment>%s</comment> has been dropped.</info>', $tablesToDelete));
}
else
{
$output->writeln('No table <info>has been dropped</info>');
}
}
catch (\Exception $e)
{