Trap migration error for modules if they don't exist
This commit is contained in:
parent
5b10dca868
commit
a9e5554dea
@ -77,7 +77,7 @@ class MigrationService extends Service
|
||||
* Run all of the migrations that are available. Just call artisan since
|
||||
* it looks into all of the module directories, etc
|
||||
*/
|
||||
public function runAllMigrations()
|
||||
public function runAllMigrations(): string
|
||||
{
|
||||
// A little ugly, run the main migration first, this makes sure the migration table is there
|
||||
$output = '';
|
||||
@ -92,10 +92,14 @@ class MigrationService extends Service
|
||||
$migrator = $this->getMigrator();
|
||||
$availMigrations = $this->migrationsAvailable();
|
||||
|
||||
if (count($availMigrations) > 0) {
|
||||
Log::info('Running '.count($availMigrations).' available migrations');
|
||||
$ret = $migrator->run($availMigrations);
|
||||
Log::info('Ran '.count($ret).' migrations');
|
||||
|
||||
return $output."\n".implode("\n", $ret);
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
@ -126,7 +126,11 @@ class ModuleService extends Service
|
||||
'enabled' => 1,
|
||||
]);
|
||||
|
||||
try {
|
||||
Artisan::call('module:migrate '.$module_name, ['--force' => true]);
|
||||
} catch (Exception $e) {
|
||||
Log::error('Error running migration for '.$module_name.'; error='.$e);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user