phpvms/database/migrations/2017_06_17_214650_create_flights_table.php
Nabeel Shahzad b9d49a4af9 #34 uuid use
2017-06-22 21:44:49 -05:00

61 lines
1.7 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
class CreateFlightsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
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->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('notes')->nullable();
$table->boolean('active')->default(true);
$table->timestamps();
$table->primary('id');
$table->unique('flight_number');
$table->index('flight_number');
$table->index('dpt_airport_id');
$table->index('arr_airport_id');
});
Schema::create('flight_aircraft', function ($table) {
$table->uuid('flight_id');
$table->integer('aircraft_id')->unsigned();
$table->primary(['flight_id', 'aircraft_id']);
$table->index(['aircraft_id', 'flight_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('flights');
Schema::drop('flight_aircraft');
}
}