1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Merge pull request #517 from nemekzg/DDC-1765

Fix for DDC-1765
This commit is contained in:
Benjamin Eberlei 2012-11-25 03:38:39 -08:00
commit 173333c861

View File

@ -82,6 +82,10 @@ Alternatively, you can execute the generated queries:
<info>%command.name% --force</info> <info>%command.name% --force</info>
If both options are specified, the queries are output and then executed:
<info>%command.name% --dump-sql --force</info>
Finally, be aware that if the <info>--complete</info> option is passed, this Finally, be aware that if the <info>--complete</info> option is passed, this
task will drop all database assets (e.g. tables, etc) that are *not* described task will drop all database assets (e.g. tables, etc) that are *not* described
by the current metadata. In other words, without this option, this task leaves by the current metadata. In other words, without this option, this task leaves
@ -107,21 +111,20 @@ EOT
$dumpSql = true === $input->getOption('dump-sql'); $dumpSql = true === $input->getOption('dump-sql');
$force = true === $input->getOption('force'); $force = true === $input->getOption('force');
if ($dumpSql && $force) {
throw new \InvalidArgumentException('You can pass either the --dump-sql or the --force option (but not both simultaneously).');
}
if ($dumpSql) { if ($dumpSql) {
$output->writeln(implode(';' . PHP_EOL, $sqls)); $output->writeln(implode(';' . PHP_EOL, $sqls));
return 0;
} }
if ($force) { if ($force) {
if ($dumpSql) {
$output->writeln('');
}
$output->writeln('Updating database schema...'); $output->writeln('Updating database schema...');
$schemaTool->updateSchema($metadatas, $saveMode); $schemaTool->updateSchema($metadatas, $saveMode);
$output->writeln(sprintf('Database schema updated successfully! "<info>%s</info>" queries were executed', count($sqls))); $output->writeln(sprintf('Database schema updated successfully! "<info>%s</info>" queries were executed', count($sqls)));
}
if ($dumpSql || $force) {
return 0; return 0;
} }
@ -131,7 +134,7 @@ EOT
$output->writeln(''); $output->writeln('');
$output->writeln(sprintf('The Schema-Tool would execute <info>"%s"</info> queries to update the database.', count($sqls))); $output->writeln(sprintf('The Schema-Tool would execute <info>"%s"</info> queries to update the database.', count($sqls)));
$output->writeln('Please run the operation by passing one of the following options:'); $output->writeln('Please run the operation by passing one - or both - of the following options:');
$output->writeln(sprintf(' <info>%s --force</info> to execute the command', $this->getName())); $output->writeln(sprintf(' <info>%s --force</info> to execute the command', $this->getName()));
$output->writeln(sprintf(' <info>%s --dump-sql</info> to dump the SQL statements to the screen', $this->getName())); $output->writeln(sprintf(' <info>%s --dump-sql</info> to dump the SQL statements to the screen', $this->getName()));