29 lines
849 B
PHP
29 lines
849 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace App\Console\Commands;
|
||
|
|
|
||
|
|
use Illuminate\Contracts\Events\Dispatcher;
|
||
|
|
use Illuminate\Database\Console\Migrations\MigrateCommand as BaseMigrateCommand;
|
||
|
|
use Illuminate\Database\Migrations\Migrator;
|
||
|
|
|
||
|
|
class MigrateCommand extends BaseMigrateCommand
|
||
|
|
{
|
||
|
|
public function __construct(Migrator $migrator, Dispatcher $dispatcher)
|
||
|
|
{
|
||
|
|
parent::__construct($migrator, $dispatcher);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Never auto-load database/schema/*.sql — it DROP TABLEs and wipes production data
|
||
|
|
* when the migrations table is empty. Use baseline_migrations.sql on existing DBs.
|
||
|
|
*/
|
||
|
|
protected function prepareDatabase()
|
||
|
|
{
|
||
|
|
if (! $this->migrator->repositoryExists()) {
|
||
|
|
$this->call('migrate:install', array_filter([
|
||
|
|
'--database' => $this->option('database'),
|
||
|
|
]));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|