2017-06-18 06:25:36 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
2017-12-13 01:57:52 +08:00
|
|
|
class CreateFlightTables extends Migration
|
2017-06-18 06:25:36 +08:00
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('flights', function (Blueprint $table) {
|
2017-12-13 03:26:08 +08:00
|
|
|
$table->string('id', 12);
|
|
|
|
$table->unsignedInteger('airline_id');
|
2017-07-11 07:54:51 +08:00
|
|
|
$table->string('flight_number', 10);
|
|
|
|
$table->string('route_code', 5)->nullable();
|
|
|
|
$table->string('route_leg', 5)->nullable();
|
2017-12-01 10:28:45 +08:00
|
|
|
$table->string('dpt_airport_id', 5);
|
|
|
|
$table->string('arr_airport_id', 5);
|
|
|
|
$table->string('alt_airport_id', 5)->nullable();
|
2017-06-20 00:30:18 +08:00
|
|
|
$table->text('route')->nullable();
|
2017-12-13 03:26:08 +08:00
|
|
|
$table->string('dpt_time', 10)->nullable();
|
|
|
|
$table->string('arr_time', 10)->nullable();
|
|
|
|
$table->unsignedDecimal('flight_time', 19)->nullable();
|
2017-06-20 00:30:18 +08:00
|
|
|
$table->text('notes')->nullable();
|
|
|
|
$table->boolean('active')->default(true);
|
2017-06-18 06:25:36 +08:00
|
|
|
$table->timestamps();
|
2017-06-20 00:30:18 +08:00
|
|
|
|
2017-06-23 10:44:49 +08:00
|
|
|
$table->primary('id');
|
|
|
|
|
2017-06-20 00:30:18 +08:00
|
|
|
$table->unique('flight_number');
|
|
|
|
|
|
|
|
$table->index('flight_number');
|
|
|
|
$table->index('dpt_airport_id');
|
|
|
|
$table->index('arr_airport_id');
|
2017-06-18 06:25:36 +08:00
|
|
|
});
|
2017-07-11 07:54:51 +08:00
|
|
|
|
|
|
|
Schema::create('flight_fields', function (Blueprint $table) {
|
2017-12-13 03:26:08 +08:00
|
|
|
$table->increments('id');
|
|
|
|
$table->string('flight_id', 12);
|
2017-07-11 07:54:51 +08:00
|
|
|
$table->string('name', 50);
|
|
|
|
$table->text('value');
|
2017-07-12 06:44:12 +08:00
|
|
|
$table->timestamps();
|
2017-08-04 10:02:02 +08:00
|
|
|
|
2017-12-13 03:26:08 +08:00
|
|
|
$table->index('flight_id');
|
|
|
|
});
|
2017-06-18 06:25:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::drop('flights');
|
2017-07-13 23:15:41 +08:00
|
|
|
Schema::drop('flight_fields');
|
2017-06-18 06:25:36 +08:00
|
|
|
}
|
|
|
|
}
|