add separate flight_fields table and move over to flight_field_values

This commit is contained in:
Nabeel Shahzad
2018-03-20 13:06:06 -05:00
parent a9454c319a
commit 485c6e86bb
17 changed files with 147 additions and 45 deletions

View File

@@ -14,7 +14,7 @@ class CreateFlightTables extends Migration
public function up()
{
Schema::create('flights', function (Blueprint $table) {
$table->string('id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->unsignedInteger('airline_id');
$table->string('flight_number', 10);
$table->string('route_code', 5)->nullable();
@@ -42,7 +42,7 @@ class CreateFlightTables extends Migration
});
Schema::create('flight_fare', function (Blueprint $table) {
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('flight_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->unsignedInteger('fare_id');
$table->string('price', 10)->nullable();
$table->string('cost', 10)->nullable();
@@ -52,9 +52,21 @@ class CreateFlightTables extends Migration
$table->primary(['flight_id', 'fare_id']);
});
/**
* Hold a master list of fields
*/
Schema::create('flight_fields', function (Blueprint $table) {
$table->increments('id');
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('name', 50);
$table->string('slug', 50)->nullable();
});
/**
* The values for the actual fields
*/
Schema::create('flight_field_values', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('flight_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->string('name', 50);
$table->text('value');
$table->timestamps();

View File

@@ -16,7 +16,7 @@ class CreatePirepTables extends Migration
public function up()
{
Schema::create('pireps', function (Blueprint $table) {
$table->string('id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->unsignedInteger('user_id');
$table->unsignedInteger('airline_id');
$table->unsignedInteger('aircraft_id')->nullable();
@@ -52,7 +52,7 @@ class CreatePirepTables extends Migration
Schema::create('pirep_comments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('pirep_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->unsignedInteger('user_id');
$table->text('comment');
$table->timestamps();
@@ -60,7 +60,7 @@ class CreatePirepTables extends Migration
Schema::create('pirep_fares', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('pirep_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->unsignedInteger('fare_id');
$table->unsignedInteger('count')->nullable()->default(0);
@@ -68,7 +68,7 @@ class CreatePirepTables extends Migration
});
Schema::create('pirep_fields', function (Blueprint $table) {
$table->bigIncrements('id');
$table->increments('id');
$table->string('name', 50);
$table->string('slug', 50)->nullable();
$table->boolean('required')->nullable()->default(false);
@@ -76,7 +76,7 @@ class CreatePirepTables extends Migration
Schema::create('pirep_field_values', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('pirep_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->string('name', 50);
$table->string('slug', 50)->nullable();
$table->string('value')->nullable();

View File

@@ -16,7 +16,7 @@ class CreateBidsTable extends Migration
Schema::create('bids', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('user_id');
$table->string('flight_id', \App\Models\Flight::ID_MAX_LENGTH);
$table->string('flight_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->timestamps();
$table->index('user_id');

View File

@@ -15,7 +15,7 @@ class CreateAcarsTables extends Migration
{
Schema::create('acars', function (Blueprint $table) {
$table->string('id', 12);
$table->string('pirep_id', \App\Models\Pirep::ID_MAX_LENGTH);
$table->string('pirep_id', \App\Interfaces\Model::ID_MAX_LENGTH);
$table->unsignedTinyInteger('type');
$table->unsignedInteger('nav_type')->nullable();
$table->unsignedInteger('order')->default(0);

View File

@@ -346,6 +346,12 @@ flights:
updated_at: NOW
flight_fields:
- name: Departure Gate
slug: departure_gate
- name: Arrival Gate
slug: arrival_gate
flight_field_values:
- id: 1
flight_id: flightid_1
name: cost index