| @@ 9-48 (lines=40) @@ | ||
| 6 | ||
| 7 | use Illuminate\Console\Command; |
|
| 8 | ||
| 9 | class MigrateCommand extends Command |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * The name and signature of the console command. |
|
| 13 | * |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $signature = 'sierratecnologia:migrate:statistics {--force : Force the operation to run when in production.}'; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * The console command description. |
|
| 20 | * |
|
| 21 | * @var string |
|
| 22 | */ |
|
| 23 | protected $description = 'Migrate SierraTecnologia Statistics Tables.'; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Execute the console command. |
|
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function handle(): void |
|
| 31 | { |
|
| 32 | $this->alert($this->description); |
|
| 33 | ||
| 34 | if (file_exists($path = 'database/migrations/sierratecnologia/laravel-statistics')) { |
|
| 35 | $this->call( |
|
| 36 | 'migrate', [ |
|
| 37 | '--step' => true, |
|
| 38 | '--path' => $path, |
|
| 39 | '--force' => $this->option('force'), |
|
| 40 | ] |
|
| 41 | ); |
|
| 42 | } else { |
|
| 43 | $this->warn('No migrations found! Consider publish them first: <fg=green>php artisan sierratecnologia:publish:statistics</>'); |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->line(''); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||
| @@ 9-48 (lines=40) @@ | ||
| 6 | ||
| 7 | use Illuminate\Console\Command; |
|
| 8 | ||
| 9 | class RollbackCommand extends Command |
|
| 10 | { |
|
| 11 | /** |
|
| 12 | * The name and signature of the console command. |
|
| 13 | * |
|
| 14 | * @var string |
|
| 15 | */ |
|
| 16 | protected $signature = 'sierratecnologia:rollback:statistics {--force : Force the operation to run when in production.}'; |
|
| 17 | ||
| 18 | /** |
|
| 19 | * The console command description. |
|
| 20 | * |
|
| 21 | * @var string |
|
| 22 | */ |
|
| 23 | protected $description = 'Rollback SierraTecnologia Statistics Tables.'; |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Execute the console command. |
|
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function handle(): void |
|
| 31 | { |
|
| 32 | $this->alert($this->description); |
|
| 33 | ||
| 34 | if (file_exists($path = 'database/migrations/sierratecnologia/laravel-statistics')) { |
|
| 35 | $this->call( |
|
| 36 | 'migrate:reset', [ |
|
| 37 | '--step' => true, |
|
| 38 | '--path' => $path, |
|
| 39 | '--force' => $this->option('force'), |
|
| 40 | ] |
|
| 41 | ); |
|
| 42 | } else { |
|
| 43 | $this->warn('No migrations found! Consider publish them first: <fg=green>php artisan sierratecnologia:publish:statistics</>'); |
|
| 44 | } |
|
| 45 | ||
| 46 | $this->line(''); |
|
| 47 | } |
|
| 48 | } |
|
| 49 | ||