string('id', 12); $table->unsignedInteger('user_id'); $table->unsignedInteger('airline_id'); $table->unsignedInteger('aircraft_id')->nullable(); $table->uuid('flight_id')->nullable(); $table->string('flight_number', 10)->nullable(); $table->string('route_code', 5)->nullable(); $table->string('route_leg', 5)->nullable(); $table->string('dpt_airport_id', 5); $table->string('arr_airport_id', 5); $table->unsignedDecimal('flight_time', 19); $table->unsignedDecimal('gross_weight', 19)->nullable(); $table->unsignedDecimal('fuel_used', 19)->nullable(); $table->string('route')->nullable(); $table->string('notes')->nullable(); $table->unsignedTinyInteger('source')->default(0); $table->unsignedTinyInteger('status')->default(0); $table->longText('raw_data')->nullable(); $table->timestamps(); $table->softDeletes(); $table->primary('id'); $table->index('user_id'); $table->index('flight_id'); $table->index('dpt_airport_id'); $table->index('arr_airport_id'); }); Schema::create('pirep_comments', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('pirep_id', 12); $table->unsignedInteger('user_id'); $table->text('comment'); $table->timestamps(); }); Schema::create('pirep_events', function(Blueprint $table) { $table->bigIncrements('id'); $table->string('pirep_id', 12); $table->string('event', 64); $table->dateTime('dt'); }); /* * Financial tables/fields */ Schema::create('pirep_expenses', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('pirep_id', 12); $table->string('name'); $table->double('value', 19, 2)->nullable(); $table->index('pirep_id'); }); Schema::create('pirep_fares', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('pirep_id', 12); $table->unsignedBigInteger('fare_id'); $table->unsignedInteger('count')->nullable(); $table->index('pirep_id'); }); /* * Additional PIREP data */ Schema::create('pirep_fields', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('name', 50); $table->boolean('required')->default(false); $table->timestamps(); }); Schema::create('pirep_field_values', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('pirep_id', 12); $table->string('name', 50); $table->string('value')->nullable(); $table->string('source')->nullable(); $table->timestamps(); $table->index('pirep_id'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('pireps'); Schema::dropIfExists('pirep_comments'); Schema::dropIfExists('pirep_expenses'); Schema::dropIfExists('pirep_fares'); Schema::dropIfExists('pirep_fields'); Schema::dropIfExists('pirep_field_values'); } }