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
+1 -5
View File
@@ -58,11 +58,7 @@ reset: cleanapp/Models/Traits/JournalTrait.php
.PHONY: reload-db .PHONY: reload-db
reload-db: reload-db:
@php artisan database:create --reset @php artisan phpvms:dev-install --reset-db
@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
.PHONY: tests .PHONY: tests
tests: test tests: test
+14 -7
View File
@@ -14,6 +14,14 @@ class DevInstall extends Command
protected $signature = 'phpvms:dev-install {--reset-db}'; protected $signature = 'phpvms:dev-install {--reset-db}';
protected $description = 'Run a developer install and run the sample migration'; 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 * Run dev related commands
* @throws \Symfony\Component\HttpFoundation\File\Exception\FileException * @throws \Symfony\Component\HttpFoundation\File\Exception\FileException
@@ -34,9 +42,6 @@ class DevInstall extends Command
$this->info(\Artisan::output()); $this->info(\Artisan::output());
#
#
$this->info('Running migrations'); $this->info('Running migrations');
\Artisan::call('migrate:fresh', [ \Artisan::call('migrate:fresh', [
'--seed' => true, '--seed' => true,
@@ -48,11 +53,13 @@ class DevInstall extends Command
# #
$this->info('Importing sample data'); $this->info('Importing sample data');
\Artisan::call('phpvms:yaml-import', [ foreach($this->yaml_imports as $yml) {
'files' => ['app/Database/seeds/sample.yml'], \Artisan::call('phpvms:yaml-import', [
]); 'files' => ['app/Database/seeds/' . $yml],
]);
$this->info(\Artisan::output()); $this->info(\Artisan::output());
}
$this->info('Done!'); $this->info('Done!');
} }