From 999f4ce16b6c3dd578a59fe1f0d247e3acc570ad Mon Sep 17 00:00:00 2001 From: Lorenzo Millucci <5730780+lmillucci@users.noreply.github.com> Date: Wed, 30 May 2018 09:41:40 +0200 Subject: [PATCH] #70: Fix --no-interaction for VersionCommand (#71) --- src/Console/VersionCommand.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Console/VersionCommand.php b/src/Console/VersionCommand.php index 0ee4874..01f0b2b 100644 --- a/src/Console/VersionCommand.php +++ b/src/Console/VersionCommand.php @@ -54,11 +54,15 @@ public function handle(ConfigurationProvider $provider) $this->markMigrated = (boolean) $this->option('add'); - $question = 'WARNING! You are about to add, delete or synchronize migration versions from the version table that could result in data lost. Are you sure you wish to continue? (y/n)'; - if ($this->confirm($question)) { - $this->markVersions(); + if ($this->input->isInteractive()) { + $question = 'WARNING! You are about to add, delete or synchronize migration versions from the version table that could result in data lost. Are you sure you wish to continue? (y/n)'; + if ($this->confirm($question)) { + $this->markVersions(); + } else { + $this->error('Migration cancelled!'); + } } else { - $this->error('Migration cancelled!'); + $this->markVersions(); } }