From 62a8e2aad57cdf41fa4828cf7e3d88c53400aecb Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Tue, 21 Sep 2010 22:08:29 +0200 Subject: [PATCH] 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). --- .../ORM/Tools/Console/Command/SchemaTool/CreateCommand.php | 2 ++ .../ORM/Tools/Console/Command/SchemaTool/DropCommand.php | 2 ++ .../ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php index c3870221b..a772381b3 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/CreateCommand.php @@ -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); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/DropCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/DropCommand.php index af6d8d026..6e4811b0e 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/DropCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/DropCommand.php @@ -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); diff --git a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php index 193d8acc9..0677347f9 100644 --- a/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php +++ b/lib/Doctrine/ORM/Tools/Console/Command/SchemaTool/UpdateCommand.php @@ -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(<<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);