FEATURE #2503: add easier installer

This commit is contained in:
Michal Kváček
2017-08-24 14:15:08 +02:00
parent 8946ef7441
commit ce183d4805
9 changed files with 9921 additions and 6040 deletions
+9 -6
View File
@@ -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.');
}
}