1
0
mirror of synced 2025-02-20 22:23:14 +03:00

Enhance Schema-Tool commands by being more aggresive on warning the user that these commands do stuff that can be potentially dangerous to the database (and its contents).

This commit is contained in:
Benjamin Eberlei 2010-09-21 22:08:29 +02:00
parent 6d20d7d5ed
commit 62a8e2aad5
3 changed files with 9 additions and 1 deletions

View File

@ -65,6 +65,8 @@ EOT
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
$output->write('ATTENTION: This operation should not be executed in an production enviroment.' . PHP_EOL . PHP_EOL);
if ($input->getOption('dump-sql') === true) {
$sqls = $schemaTool->getCreateSchemaSql($metadatas);
$output->write(implode(';' . PHP_EOL, $sqls) . PHP_EOL);

View File

@ -70,6 +70,8 @@ EOT
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
$output->write('ATTENTION: This operation should not be executed in an production enviroment.' . PHP_EOL . PHP_EOL);
if ($input->getOption('dump-sql') === true) {
$sqls = $schemaTool->getDropSchemaSql($metadatas);
$output->write(implode(';' . PHP_EOL, $sqls) . PHP_EOL);

View File

@ -62,7 +62,7 @@ class UpdateCommand extends AbstractCommand
),
new InputOption(
'force', null, InputOption::PARAMETER_NONE,
"Don't ask for the deletion of the database, but force the operation to run."
"Don't ask for the incremental update of the database, but force the operation to run."
),
))
->setHelp(<<<EOT
@ -75,6 +75,10 @@ EOT
protected function executeSchemaCommand(InputInterface $input, OutputInterface $output, SchemaTool $schemaTool, array $metadatas)
{
$output->write('ATTENTION: This operation should not be executed in an production enviroment.' . PHP_EOL);
$output->write('Use the incremental update to detect changes during development and use' . PHP_EOL);
$output->write('this SQL DDL to manually update your database in production.' . PHP_EOL . PHP_EOL);
// Defining if update is complete or not (--complete not defined means $saveMode = true)
$saveMode = ($input->getOption('complete') !== true);