Multiple ticket crash fixes (#347)
* Fix for initial seed data not being run during install closes #346 * StyleCI keepin' me honest * Tooltips for ranks
This commit is contained in:
@@ -9,7 +9,8 @@ use App\Models\Pirep;
|
||||
use App\Models\User;
|
||||
use App\Services\AwardService;
|
||||
use App\Services\DatabaseService;
|
||||
use DB;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use PDO;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
@@ -46,12 +47,13 @@ class DevCommands extends Command
|
||||
}
|
||||
|
||||
$commands = [
|
||||
'list-awards' => 'listAwardClasses',
|
||||
'clear-acars' => 'clearAcars',
|
||||
'clear-users' => 'clearUsers',
|
||||
'compile-assets' => 'compileAssets',
|
||||
'db-attrs' => 'dbAttrs',
|
||||
'list-awards' => 'listAwardClasses',
|
||||
'manual-insert' => 'manualInsert',
|
||||
'reset-install' => 'resetInstall',
|
||||
'xml-to-yaml' => 'xmlToYaml',
|
||||
];
|
||||
|
||||
@@ -212,4 +214,33 @@ class DevCommands extends Command
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete all of the tables, etc from the database, for a clean install
|
||||
*/
|
||||
protected function resetInstall(): void
|
||||
{
|
||||
$confirm = $this->ask('This will erase your entire install and database, are you sure? y/n ');
|
||||
if (strtolower($confirm) !== 'y') {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (config('database.default') === 'mysql') {
|
||||
DB::statement('SET foreign_key_checks=0');
|
||||
}
|
||||
|
||||
$this->info('Dropping all tables');
|
||||
$tables = DB::connection()->getDoctrineSchemaManager()->listTableNames();
|
||||
foreach ($tables as $table) {
|
||||
Schema::dropIfExists($table);
|
||||
}
|
||||
|
||||
$this->info('Deleting config file');
|
||||
unlink('config.php');
|
||||
|
||||
$this->info('Deleting env file');
|
||||
unlink('env.php');
|
||||
|
||||
$this->info('Done!');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#
|
||||
# Initial minimal data required. You probably don't
|
||||
# want to modify or erase any of this here
|
||||
#
|
||||
|
||||
airports:
|
||||
- id: KAUS
|
||||
iata: AUS
|
||||
icao: KAUS
|
||||
name: Austin-Bergstrom
|
||||
location: Austin, Texas, USA
|
||||
country: United States
|
||||
timezone: America/Chicago
|
||||
lat: 30.1945278
|
||||
lon: -97.6698889
|
||||
hub: 1
|
||||
Reference in New Issue
Block a user