* Update module migrate command to avoid errors.

* Fixed issue #1414
This commit is contained in:
Yash Govekar 2022-10-24 20:41:00 +05:30 committed by GitHub
parent 2f9e8583f2
commit b4311b861f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 7 deletions

View File

@ -124,10 +124,22 @@ class FlightImporter extends ImportExport
} }
// Create/check that they exist // Create/check that they exist
$this->processAirport($row['dpt_airport']); $process_dep = $this->processAirport($row['dpt_airport']);
$this->processAirport($row['arr_airport']); if (is_null($process_dep)) {
$this->log('Could not import row '.$index.'. Departure Airport not found!');
return false;
}
$process_arr = $this->processAirport($row['arr_airport']);
if (is_null($process_arr)) {
$this->log('Could not import row '.$index.'. Arrival Airport not found!');
return false;
}
if ($row['alt_airport']) { if ($row['alt_airport']) {
$this->processAirport($row['alt_airport']); $process_alt = $this->processAirport($row['alt_airport']);
if (is_null($process_alt)) {
$this->log('Could not import row '.$index.'. Alternate Airport not found!');
return false;
}
} }
// Check/calculate the distance // Check/calculate the distance
@ -198,7 +210,7 @@ class FlightImporter extends ImportExport
* *
* @return Airport * @return Airport
*/ */
protected function processAirport($airport): Airport protected function processAirport($airport): Airport|null
{ {
return $this->airportSvc->lookupAirportIfNotFound($airport); return $this->airportSvc->lookupAirportIfNotFound($airport);
} }

View File

@ -170,7 +170,7 @@ class ModuleService extends Service
]); ]);
try { try {
Artisan::call('module:migrate '.$module_name, ['--force' => true]); Artisan::call('module:migrate '.$module_name);
} catch (Exception $e) { } catch (Exception $e) {
Log::error('Error running migration for '.$module_name.'; error='.$e); Log::error('Error running migration for '.$module_name.'; error='.$e);
} }
@ -269,7 +269,7 @@ class ModuleService extends Service
} }
Artisan::call('config:cache'); Artisan::call('config:cache');
Artisan::call('module:migrate '.$module, ['--force' => true]); Artisan::call('module:migrate '.$module);
return flash()->success('Module Installed'); return flash()->success('Module Installed');
} }
@ -290,7 +290,7 @@ class ModuleService extends Service
]); ]);
if ($status === true) { if ($status === true) {
Artisan::call('module:migrate '.$module->name, ['--force' => true]); Artisan::call('module:migrate '.$module->name);
} }
return true; return true;