Skip to content

Commit 56e2708

Browse files
committed
Added confirmation before reset database.
1 parent 050851e commit 56e2708

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Console/ResetCommand.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
use Symfony\Component\Console\Input\InputInterface;
1212
use Symfony\Component\Console\Output\OutputInterface;
13+
use Symfony\Component\Console\Question\ConfirmationQuestion;
1314

1415
class ResetCommand extends ConsoleCommand
1516
{
@@ -24,6 +25,14 @@ protected function configure()
2425

2526
protected function execute(InputInterface $input, OutputInterface $output)
2627
{
28+
$helper = $this->getHelper('question');
29+
$question = new ConfirmationQuestion('This will ERASE all of data in your data. Continue with this action? (y/N) ', false);
30+
31+
if (!$helper->ask($input, $output, $question)) {
32+
$output->writeln('Aborted.');
33+
return;
34+
}
35+
2736
parent::execute($input, $output);
2837
$this->migration->prepareEnvironment();
2938
$this->migration->reset($this->upTo);

0 commit comments

Comments
 (0)