Use artisan for the reload-db dev command

This commit is contained in:
Nabeel Shahzad
2018-05-10 10:17:41 -05:00
parent 42c6a11780
commit 62aa825c0f
2 changed files with 15 additions and 12 deletions

View File

@@ -58,11 +58,7 @@ reset: cleanapp/Models/Traits/JournalTrait.php
.PHONY: reload-db
reload-db:
@php artisan database:create --reset
@php artisan migrate:fresh --seed
@php artisan phpvms:yaml-import app/Database/seeds/sample.yml
@php artisan phpvms:yaml-import app/Database/seeds/acars.yml
#php artisan phpvms:navdata
@php artisan phpvms:dev-install --reset-db
.PHONY: tests
tests: test

View File

@@ -14,6 +14,14 @@ class DevInstall extends Command
protected $signature = 'phpvms:dev-install {--reset-db}';
protected $description = 'Run a developer install and run the sample migration';
/**
* The YAML files with sample data to import
*/
protected $yaml_imports = [
'sample.yml',
'acars.yml',
];
/**
* Run dev related commands
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
@@ -34,9 +42,6 @@ class DevInstall extends Command
$this->info(\Artisan::output());
#
#
$this->info('Running migrations');
\Artisan::call('migrate:fresh', [
'--seed' => true,
@@ -48,11 +53,13 @@ class DevInstall extends Command
#
$this->info('Importing sample data');
\Artisan::call('phpvms:yaml-import', [
'files' => ['app/Database/seeds/sample.yml'],
]);
foreach($this->yaml_imports as $yml) {
\Artisan::call('phpvms:yaml-import', [
'files' => ['app/Database/seeds/' . $yml],
]);
$this->info(\Artisan::output());
$this->info(\Artisan::output());
}
$this->info('Done!');
}