Skip to content

Commit

Permalink
Added confirmation before reset database.
Browse files Browse the repository at this point in the history
  • Loading branch information
byjg committed Sep 23, 2016
1 parent 050851e commit 56e2708
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Console/ResetCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

class ResetCommand extends ConsoleCommand
{
Expand All @@ -24,6 +25,14 @@ protected function configure()

protected function execute(InputInterface $input, OutputInterface $output)
{
$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('This will ERASE all of data in your data. Continue with this action? (y/N) ', false);

if (!$helper->ask($input, $output, $question)) {
$output->writeln('Aborted.');
return;
}

parent::execute($input, $output);
$this->migration->prepareEnvironment();
$this->migration->reset($this->upTo);
Expand Down

0 comments on commit 56e2708

Please sign in to comment.