Non puoi selezionare più di 25 argomenti
Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
52 righe
1.4 KiB
52 righe
1.4 KiB
<?php |
|
|
|
namespace App\Console\Commands\Database\Main; |
|
|
|
use Illuminate\Console\Command; |
|
use Illuminate\Support\Facades\DB; |
|
use Illuminate\Support\Facades\Config; |
|
|
|
class MigrateCommand extends Command |
|
{ |
|
/** |
|
* The name and signature of the console command. |
|
* |
|
* @var string |
|
*/ |
|
protected $signature = 'maindb:migrate |
|
{--force : Force the operation to run when in production} |
|
{--pretend : Dump the SQL queries that would be run} |
|
{--step : Force the migrations to be run so they can be rolled back individually}'; |
|
|
|
/** |
|
* The console command description. |
|
* |
|
* @var string |
|
*/ |
|
protected $description = 'Run main database migrations'; |
|
|
|
/** |
|
* Create a new command instance. |
|
* |
|
* @return void |
|
*/ |
|
public function __construct() |
|
{ |
|
parent::__construct(); |
|
} |
|
|
|
/** |
|
* Execute the console command. |
|
* |
|
* @return int |
|
*/ |
|
public function handle() |
|
{ |
|
setup_db_connection(); |
|
$options = ['--path' => 'database/migrations/main', '--database' => 'mysql']; |
|
if(!empty( $this->option('force'))) { $options['--force'] = true; } |
|
if(!empty( $this->option('step'))) { $options['--step'] = true; } |
|
if(!empty( $this->option('pretend'))) { $options['--pretend'] = true; } |
|
$this->call('migrate', $options); |
|
} |
|
}
|
|
|