Fixes for installer/modules race condition (#883)
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use App\Contracts\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
@@ -19,6 +19,12 @@ class CreateModulesTable extends Migration
|
||||
$table->boolean('enabled')->default(1);
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
$this->addModule(['name' => 'Awards']);
|
||||
$this->addModule(['name' => 'Sample']);
|
||||
$this->addModule(['name' => 'VMSAcars']);
|
||||
$this->addModule(['name' => 'Vacentral']);
|
||||
$this->addModule(['name' => 'TestModule']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,15 +1,21 @@
|
||||
<?php
|
||||
|
||||
use App\Services\Installer\MigrationService;
|
||||
use App\Services\Installer\SeederService;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
private $seederService;
|
||||
/** @var MigrationService */
|
||||
private $migrationSvc;
|
||||
|
||||
/** @var SeederService */
|
||||
private $seederSvc;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->seederService = app(SeederService::class);
|
||||
$this->migrationSvc = app(MigrationService::class);
|
||||
$this->seederSvc = app(SeederService::class);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -19,6 +25,12 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->seederService->syncAllSeeds();
|
||||
// Make sure any migrations that need to be run are run/cleared out
|
||||
if ($this->migrationSvc->migrationsAvailable()) {
|
||||
$this->migrationSvc->runAllMigrations();
|
||||
}
|
||||
|
||||
// Then sync all of the seeds
|
||||
$this->seederSvc->syncAllSeeds();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user