FEATURE #2503: add easier installer
This commit is contained in:
@@ -13,14 +13,14 @@ class InitDatabaseSchema extends Command
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'db:init {schema.sql}';
|
||||
protected $signature = 'db:init';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Command description';
|
||||
protected $description = 'Init database structure';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
@@ -39,13 +39,16 @@ class InitDatabaseSchema extends Command
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
do {
|
||||
$schema = $this->ask('Path to database schema file', 'database/schema.sql');
|
||||
} while (!file_exists($schema));
|
||||
|
||||
$schema = $this->argument('schema.sql');
|
||||
|
||||
if (!file_exists($schema)) throw new NotFoundHttpException('File '.$schema.' does not exist.');
|
||||
|
||||
DB::unprepared(file_get_contents($schema));
|
||||
|
||||
$this->line('Successfully imported');
|
||||
$this->call('migrate');
|
||||
$this->call('db:seed');
|
||||
|
||||
$this->line('Database successfully initialized.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user