Adjust columns in migrations and give lens to strings and custom flight fields #48

This commit is contained in:
Nabeel Shahzad
2017-07-10 18:54:51 -05:00
parent 6f745091de
commit b5dd700044
14 changed files with 73 additions and 32 deletions

View File

@@ -15,9 +15,9 @@ class CreateAirlinesTable extends Migration
{
Schema::create('airlines', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
$table->char('country', 2)->nullable();
$table->string('code', 5);
$table->string('name', 50);
$table->string('country', 2)->nullable();
$table->boolean('active');
$table->timestamps();

View File

@@ -11,10 +11,10 @@ class CreateAircraftsTable extends Migration
$table->increments('id');
$table->integer('subfleet_id')->unsigned();
$table->integer('airport_id')->unsigned()->nullable();
$table->string('hex_code')->nullable();
$table->string('name');
$table->string('registration')->nullable();
$table->string('tail_number')->nullable();
$table->string('hex_code', 10)->nullable();
$table->string('name', 50);
$table->string('registration', 10)->nullable();
$table->string('tail_number', 10)->nullable();
$table->boolean('active')->default(true);
$table->timestamps();

View File

@@ -15,14 +15,16 @@ class CreateFaresTable extends Migration
{
Schema::create('fares', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('name');
$table->string('code', 50);
$table->string('name', 50);
$table->decimal('price', 19, 2)->default(0.0);
$table->decimal('cost', 19, 2)->default(0.0);
$table->integer('capacity')->default(0)->unsigned();
$table->string('notes')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
$table->primary('id');
});
}

View File

@@ -16,9 +16,9 @@ class CreateAirportsTable extends Migration
Schema::create('airports', function (Blueprint $table) {
$table->increments('id');
$table->string('icao', 5)->unique();
$table->string('name');
$table->string('location')->nullable();
$table->string('country')->nullable();
$table->string('name', 50);
$table->string('location', 50)->nullable();
$table->string('country', 50)->nullable();
$table->double('fuel_100ll_cost', 19, 2)->default(0);
$table->double('fuel_jeta_cost', 19, 2)->default(0);
$table->double('fuel_mogas_cost', 19, 2)->default(0);

View File

@@ -16,15 +16,16 @@ class CreateFlightsTable extends Migration
Schema::create('flights', function (Blueprint $table) {
$table->uuid('id');
$table->integer('airline_id')->unsigned();
$table->text('flight_number');
$table->text('route_code')->nullable();
$table->text('route_leg')->nullable();
$table->string('flight_number', 10);
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->integer('dpt_airport_id')->unsigned();
$table->integer('arr_airport_id')->unsigned();
$table->integer('alt_airport_id')->unsigned()->nullable();
$table->text('route')->nullable();
$table->text('dpt_time')->nullable();
$table->text('arr_time')->nullable();
$table->text('dpt_time', 10)->nullable();
$table->text('arr_time', 10)->nullable();
$table->double('flight_time', 19, 2)->unsigned();
$table->text('notes')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
@@ -37,6 +38,13 @@ class CreateFlightsTable extends Migration
$table->index('dpt_airport_id');
$table->index('arr_airport_id');
});
Schema::create('flight_fields', function (Blueprint $table) {
$table->increments('id');
$table->uuid('flight_id');
$table->string('name', 50);
$table->text('value');
});
}
/**

View File

@@ -15,7 +15,7 @@ class CreateRanksTable extends Migration
{
Schema::create('ranks', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('name', 50);
$table->integer('hours')->default(0);
$table->boolean('auto_approve_acars')->default(false);
$table->boolean('auto_approve_manual')->default(false);

View File

@@ -16,19 +16,18 @@ class CreateSubfleetsTable extends Migration
Schema::create('subfleets', function (Blueprint $table) {
$table->increments('id');
$table->integer('airline_id')->unsigned()->nullable();
$table->string('name');
$table->text('type');
$table->string('name', 50);
$table->string('type', 7);
$table->tinyInteger('fuel_type')->unsigned()->nullable();
$table->double('cargo_capacity', 19, 2)->nullable();
$table->double('fuel_capacity', 19, 2)->nullable();
$table->double('gross_weight', 19, 2)->nullable();
$table->timestamps();
$table->softDeletes();
});
Schema::create('subfleet_expenses', function(Blueprint $table) {
$table->integer('subfleet_id')->unsigned();
$table->string('name');
$table->string('name', 50);
$table->decimal('cost', 19, 2)->unsigned();
$table->primary(['subfleet_id', 'name']);

View File

@@ -16,16 +16,15 @@ class CreatePirepsTable extends Migration
Schema::create('pireps', function (Blueprint $table) {
$table->uuid('id');
$table->integer('user_id');
$table->string('flight_id');
$table->uuid('flight_id')->nullable();
$table->integer('aircraft_id');
$table->text('route_code')->nullable();
$table->text('route_leg')->nullable();
$table->string('route_code', 5)->nullable();
$table->string('route_leg', 5)->nullable();
$table->integer('dpt_airport_id')->unsigned();
$table->integer('arr_airport_id')->unsigned();
$table->integer('flight_time')->unsigned();
$table->double('flight_time', 19, 2)->unsigned();
$table->double('gross_weight', 19, 2)->nullable();
$table->double('starting_fuel', 19, 2)->nullable();
$table->double('landing_fuel', 19, 2)->nullable();
$table->double('fuel_used', 19, 2)->nullable();
$table->integer('level')->unsigned();
$table->string('route')->nullable();
$table->string('notes')->nullable();
@@ -68,7 +67,7 @@ class CreatePirepsTable extends Migration
*/
Schema::create('pirep_fields', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('name', 50);
$table->integer('required');
$table->timestamps();
});
@@ -76,8 +75,8 @@ class CreatePirepsTable extends Migration
Schema::create('pirep_field_values', function (Blueprint $table) {
$table->increments('id');
$table->uuid('pirep_id');
$table->string('name');
$table->string('value');
$table->string('name', 50);
$table->text('value');
$table->tinyInteger('source')->default(0);
$table->timestamps();