File tree 2 files changed +8
-3
lines changed
Database/Console/Migrations
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace Illuminate \Database \Console \Migrations ;
4
4
5
+ use Illuminate \Console \Command ;
5
6
use Illuminate \Console \ConfirmableTrait ;
7
+ use Illuminate \Console \Prohibitable ;
6
8
use Illuminate \Database \Migrations \Migrator ;
7
9
use Symfony \Component \Console \Attribute \AsCommand ;
8
10
use Symfony \Component \Console \Input \InputOption ;
9
11
10
12
#[AsCommand('migrate:rollback ' )]
11
13
class RollbackCommand extends BaseCommand
12
14
{
13
- use ConfirmableTrait;
15
+ use ConfirmableTrait, Prohibitable ;
14
16
15
17
/**
16
18
* The console command name.
@@ -53,8 +55,9 @@ public function __construct(Migrator $migrator)
53
55
*/
54
56
public function handle ()
55
57
{
56
- if (! $ this ->confirmToProceed ()) {
57
- return 1 ;
58
+ if ($ this ->isProhibited () ||
59
+ ! $ this ->confirmToProceed ()) {
60
+ return Command::FAILURE ;
58
61
}
59
62
60
63
$ this ->migrator ->usingConnection ($ this ->option ('database ' ), function () {
Original file line number Diff line number Diff line change 5
5
use Illuminate \Database \Console \Migrations \FreshCommand ;
6
6
use Illuminate \Database \Console \Migrations \RefreshCommand ;
7
7
use Illuminate \Database \Console \Migrations \ResetCommand ;
8
+ use Illuminate \Database \Console \Migrations \RollbackCommand ;
8
9
use Illuminate \Database \Console \WipeCommand ;
9
10
10
11
/**
@@ -132,6 +133,7 @@ public static function prohibitDestructiveCommands(bool $prohibit = true)
132
133
FreshCommand::prohibit ($ prohibit );
133
134
RefreshCommand::prohibit ($ prohibit );
134
135
ResetCommand::prohibit ($ prohibit );
136
+ RollbackCommand::prohibit ($ prohibit );
135
137
WipeCommand::prohibit ($ prohibit );
136
138
}
137
139
You can’t perform that action at this time.
0 commit comments