Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@

namespace Illuminate\Database\Console\Migrations;

use Illuminate\Console\Command;
use Illuminate\Console\ConfirmableTrait;
use Illuminate\Console\Prohibitable;
use Illuminate\Database\Migrations\Migrator;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputOption;

#[AsCommand('migrate:rollback')]
class RollbackCommand extends BaseCommand
{
use ConfirmableTrait;
use ConfirmableTrait, Prohibitable;

/**
* The console command name.
Expand Down Expand Up @@ -53,8 +55,9 @@ public function __construct(Migrator $migrator)
*/
public function handle()
{
if (! $this->confirmToProceed()) {
return 1;
if ($this->isProhibited() ||
! $this->confirmToProceed()) {
return Command::FAILURE;
}

$this->migrator->usingConnection($this->option('database'), function () {
Expand Down
2 changes: 2 additions & 0 deletions src/Illuminate/Support/Facades/DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Database\Console\Migrations\FreshCommand;
use Illuminate\Database\Console\Migrations\RefreshCommand;
use Illuminate\Database\Console\Migrations\ResetCommand;
use Illuminate\Database\Console\Migrations\RollbackCommand;
use Illuminate\Database\Console\WipeCommand;

/**
Expand Down Expand Up @@ -132,6 +133,7 @@ public static function prohibitDestructiveCommands(bool $prohibit = true)
FreshCommand::prohibit($prohibit);
RefreshCommand::prohibit($prohibit);
ResetCommand::prohibit($prohibit);
RollbackCommand::prohibit($prohibit);
WipeCommand::prohibit($prohibit);
}

Expand Down