diff --git a/app/Services/Installer/MigrationService.php b/app/Services/Installer/MigrationService.php index c3dc6908..9ff83a6e 100644 --- a/app/Services/Installer/MigrationService.php +++ b/app/Services/Installer/MigrationService.php @@ -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(); - Log::info('Running '.count($availMigrations).' available migrations'); - $ret = $migrator->run($availMigrations); - Log::info('Ran '.count($ret).' migrations'); + 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."\n".implode("\n", $ret); + } + + return $output; } } diff --git a/app/Services/ModuleService.php b/app/Services/ModuleService.php index b9b4c7fd..ca485477 100644 --- a/app/Services/ModuleService.php +++ b/app/Services/ModuleService.php @@ -126,7 +126,11 @@ class ModuleService extends Service 'enabled' => 1, ]); - Artisan::call('module:migrate '.$module_name, ['--force' => true]); + try { + Artisan::call('module:migrate '.$module_name, ['--force' => true]); + } catch (Exception $e) { + Log::error('Error running migration for '.$module_name.'; error='.$e); + } return true; }