Shrink decimal field sizes as they're overly large
This commit is contained in:
parent
7185f6cedf
commit
bac829b425
@ -24,11 +24,11 @@ class CreateUsersTable extends Migration
|
||||
$table->string('country', 2)->nullable();
|
||||
$table->string('home_airport_id', 5)->nullable();
|
||||
$table->string('curr_airport_id', 5)->nullable();
|
||||
$table->string('last_pirep_id', 12)->nullable();
|
||||
$table->string('last_pirep_id', \App\Models\Pirep::ID_MAX_LENGTH)->nullable();
|
||||
$table->unsignedBigInteger('flights')->default(0);
|
||||
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
|
||||
$table->unsignedBigInteger('transfer_time')->nullable()->default(0);
|
||||
$table->decimal('balance', 19)->nullable();
|
||||
$table->decimal('balance')->nullable();
|
||||
$table->string('timezone', 64)->nullable();
|
||||
$table->unsignedTinyInteger('status')->nullable()->default(0);
|
||||
$table->unsignedTinyInteger('state')->nullable()->default(0);
|
||||
|
@ -18,7 +18,7 @@ class CreateAircraftsTable extends Migration
|
||||
$table->string('name', 50);
|
||||
$table->string('registration', 10)->nullable();
|
||||
$table->string('hex_code', 10)->nullable();
|
||||
$table->unsignedDecimal('zfw', 12)->nullable()->default(0);
|
||||
$table->unsignedDecimal('zfw')->nullable()->default(0);
|
||||
$table->unsignedBigInteger('flight_time')->nullable()->default(0);
|
||||
$table->boolean('active')->default(true);
|
||||
$table->unsignedTinyInteger('state')->default(AircraftState::PARKED);
|
||||
|
@ -17,8 +17,8 @@ class CreateFaresTable extends Migration
|
||||
$table->increments('id');
|
||||
$table->string('code', 50);
|
||||
$table->string('name', 50);
|
||||
$table->unsignedDecimal('price', 19)->nullable()->default(0.00);
|
||||
$table->unsignedDecimal('cost', 19)->nullable()->default(0.00);
|
||||
$table->unsignedDecimal('price')->nullable()->default(0.00);
|
||||
$table->unsignedDecimal('cost')->nullable()->default(0.00);
|
||||
$table->unsignedInteger('capacity')->nullable()->default(0);
|
||||
$table->string('notes')->nullable();
|
||||
$table->boolean('active')->default(true);
|
||||
|
@ -16,9 +16,9 @@ class CreateAirportsTable extends Migration
|
||||
$table->string('country', 64)->nullable();
|
||||
$table->string('timezone', 64)->nullable();
|
||||
$table->boolean('hub')->default(false);
|
||||
$table->unsignedDecimal('fuel_100ll_cost', 8)->nullable()->default(0);
|
||||
$table->unsignedDecimal('fuel_jeta_cost', 8)->nullable()->default(0);
|
||||
$table->unsignedDecimal('fuel_mogas_cost', 8)->nullable()->default(0);
|
||||
$table->unsignedDecimal('fuel_100ll_cost')->nullable()->default(0);
|
||||
$table->unsignedDecimal('fuel_jeta_cost')->nullable()->default(0);
|
||||
$table->unsignedDecimal('fuel_mogas_cost')->nullable()->default(0);
|
||||
$table->float('lat', 7, 4)->nullable()->default(0.0);
|
||||
$table->float('lon', 7, 4)->nullable()->default(0.0);
|
||||
});
|
||||
|
@ -16,7 +16,7 @@ class CreateFlightTables extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('flights', function (Blueprint $table) {
|
||||
$table->string('id', 12);
|
||||
$table->string('id', \App\Models\Flight::ID_MAX_LENGTH);
|
||||
$table->unsignedInteger('airline_id');
|
||||
$table->string('flight_number', 10);
|
||||
$table->string('route_code', 5)->nullable();
|
||||
@ -27,7 +27,7 @@ class CreateFlightTables extends Migration
|
||||
$table->string('dpt_time', 10)->nullable();
|
||||
$table->string('arr_time', 10)->nullable();
|
||||
$table->unsignedInteger('level')->nullable()->default(0);
|
||||
$table->unsignedDecimal('distance', 19)->nullable()->default(0.0);
|
||||
$table->unsignedDecimal('distance')->nullable()->default(0.0);
|
||||
$table->unsignedInteger('flight_time')->nullable();
|
||||
$table->tinyInteger('flight_type')->default(FlightType::PASSENGER);
|
||||
$table->text('route')->nullable();
|
||||
@ -38,15 +38,13 @@ class CreateFlightTables extends Migration
|
||||
|
||||
$table->primary('id');
|
||||
|
||||
#$table->unique('flight_number');
|
||||
|
||||
$table->index('flight_number');
|
||||
$table->index('dpt_airport_id');
|
||||
$table->index('arr_airport_id');
|
||||
});
|
||||
|
||||
Schema::create('flight_fare', function (Blueprint $table) {
|
||||
$table->string('flight_id', 12);
|
||||
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
|
||||
$table->unsignedInteger('fare_id');
|
||||
$table->string('price', 10)->nullable();
|
||||
$table->string('cost', 10)->nullable();
|
||||
@ -58,7 +56,7 @@ class CreateFlightTables extends Migration
|
||||
|
||||
Schema::create('flight_fields', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->string('flight_id', 12);
|
||||
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
|
||||
$table->string('name', 50);
|
||||
$table->text('value');
|
||||
$table->timestamps();
|
||||
|
@ -19,16 +19,16 @@ class CreateSubfleetTables extends Migration
|
||||
$table->string('name', 50);
|
||||
$table->string('type', 50);
|
||||
$table->unsignedTinyInteger('fuel_type')->nullable();
|
||||
$table->unsignedDecimal('cargo_capacity', 19)->nullable();
|
||||
$table->unsignedDecimal('fuel_capacity', 19)->nullable();
|
||||
$table->unsignedDecimal('gross_weight', 19)->nullable();
|
||||
$table->unsignedDecimal('cargo_capacity')->nullable();
|
||||
$table->unsignedDecimal('fuel_capacity')->nullable();
|
||||
$table->unsignedDecimal('gross_weight')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('subfleet_expenses', function(Blueprint $table) {
|
||||
$table->unsignedBigInteger('subfleet_id');
|
||||
$table->string('name', 50);
|
||||
$table->unsignedDecimal('cost', 19);
|
||||
$table->unsignedDecimal('cost');
|
||||
|
||||
$table->primary(['subfleet_id', 'name']);
|
||||
});
|
||||
@ -36,8 +36,8 @@ class CreateSubfleetTables extends Migration
|
||||
Schema::create('subfleet_fare', function (Blueprint $table) {
|
||||
$table->unsignedInteger('subfleet_id');
|
||||
$table->unsignedInteger('fare_id');
|
||||
$table->unsignedDecimal('price', 19)->nullable();
|
||||
$table->unsignedDecimal('cost', 19)->nullable();
|
||||
$table->unsignedDecimal('price')->nullable();
|
||||
$table->unsignedDecimal('cost')->nullable();
|
||||
$table->unsignedInteger('capacity')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
@ -56,8 +56,8 @@ class CreateSubfleetTables extends Migration
|
||||
Schema::create('subfleet_rank', function(Blueprint $table) {
|
||||
$table->unsignedInteger('rank_id');
|
||||
$table->unsignedInteger('subfleet_id');
|
||||
$table->unsignedDecimal('acars_pay', 19)->nullable();
|
||||
$table->unsignedDecimal('manual_pay', 19)->nullable();
|
||||
$table->unsignedDecimal('acars_pay')->nullable();
|
||||
$table->unsignedDecimal('manual_pay')->nullable();
|
||||
|
||||
$table->primary(['rank_id', 'subfleet_id']);
|
||||
$table->index(['subfleet_id', 'rank_id']);
|
||||
|
@ -18,11 +18,11 @@ class CreatePirepTables extends Migration
|
||||
public function up()
|
||||
{
|
||||
Schema::create('pireps', function (Blueprint $table) {
|
||||
$table->string('id', 12);
|
||||
$table->string('id', \App\Models\Pirep::ID_MAX_LENGTH);
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->unsignedInteger('airline_id');
|
||||
$table->unsignedInteger('aircraft_id')->nullable();
|
||||
$table->string('flight_id', 12)->nullable();
|
||||
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH)->nullable();
|
||||
$table->string('flight_number', 10)->nullable();
|
||||
$table->string('route_code', 5)->nullable();
|
||||
$table->string('route_leg', 5)->nullable();
|
||||
@ -33,10 +33,10 @@ class CreatePirepTables extends Migration
|
||||
$table->unsignedDecimal('planned_distance')->nullable();
|
||||
$table->unsignedInteger('flight_time')->nullable();
|
||||
$table->unsignedInteger('planned_flight_time')->nullable();
|
||||
$table->unsignedDecimal('zfw', 19)->nullable();
|
||||
$table->unsignedDecimal('block_fuel', 19)->nullable();
|
||||
$table->unsignedDecimal('fuel_used', 19)->nullable();
|
||||
$table->decimal('landing_rate', 8)->nullable();
|
||||
$table->unsignedDecimal('zfw')->nullable();
|
||||
$table->unsignedDecimal('block_fuel')->nullable();
|
||||
$table->unsignedDecimal('fuel_used')->nullable();
|
||||
$table->decimal('landing_rate')->nullable();
|
||||
$table->text('route')->nullable();
|
||||
$table->text('notes')->nullable();
|
||||
$table->unsignedTinyInteger('source')->nullable()->default(0);
|
||||
@ -55,7 +55,7 @@ class CreatePirepTables extends Migration
|
||||
|
||||
Schema::create('pirep_comments', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('pirep_id', 12);
|
||||
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->text('comment');
|
||||
$table->timestamps();
|
||||
@ -66,16 +66,16 @@ class CreatePirepTables extends Migration
|
||||
*/
|
||||
Schema::create('pirep_expenses', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('pirep_id', 12);
|
||||
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
|
||||
$table->string('name');
|
||||
$table->double('value', 19, 2)->nullable();
|
||||
$table->double('value')->nullable();
|
||||
|
||||
$table->index('pirep_id');
|
||||
});
|
||||
|
||||
Schema::create('pirep_fares', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('pirep_id', 12);
|
||||
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
|
||||
$table->unsignedBigInteger('fare_id');
|
||||
$table->unsignedInteger('count')->nullable();
|
||||
|
||||
@ -94,7 +94,7 @@ class CreatePirepTables extends Migration
|
||||
|
||||
Schema::create('pirep_field_values', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('pirep_id', 12);
|
||||
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
|
||||
$table->string('name', 50);
|
||||
$table->string('value')->nullable();
|
||||
$table->string('source')->nullable();
|
||||
|
@ -16,7 +16,7 @@ class CreateBidsTable extends Migration
|
||||
Schema::create('user_bids', function (Blueprint $table) {
|
||||
$table->increments('id');
|
||||
$table->unsignedInteger('user_id');
|
||||
$table->string('flight_id', 12);
|
||||
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('user_id');
|
||||
|
@ -15,7 +15,7 @@ class CreateAcarsTables extends Migration
|
||||
{
|
||||
Schema::create('acars', function (Blueprint $table) {
|
||||
$table->string('id', 12);
|
||||
$table->string('pirep_id', 12);
|
||||
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
|
||||
$table->unsignedTinyInteger('type');
|
||||
$table->unsignedInteger('nav_type')->nullable();
|
||||
$table->unsignedInteger('order')->default(0);
|
||||
|
@ -13,6 +13,8 @@ class Flight extends BaseModel
|
||||
{
|
||||
use HashId;
|
||||
|
||||
public const ID_MAX_LENGTH = 12;
|
||||
|
||||
public $table = 'flights';
|
||||
public $incrementing = false;
|
||||
|
||||
|
@ -8,7 +8,6 @@ use App\Models\Traits\HashId;
|
||||
use App\Support\Units\Distance;
|
||||
|
||||
use App\Support\Units\Fuel;
|
||||
use App\Support\Units\Time;
|
||||
use PhpUnitsOfMeasure\Exception\NonNumericValue;
|
||||
use PhpUnitsOfMeasure\Exception\NonStringUnitName;
|
||||
|
||||
@ -21,6 +20,8 @@ class Pirep extends BaseModel
|
||||
{
|
||||
use HashId;
|
||||
|
||||
public const ID_MAX_LENGTH = 12;
|
||||
|
||||
public $table = 'pireps';
|
||||
public $incrementing = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user