2017-06-23 09:55:45 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
|
|
|
|
class CreateSubfleetsTable extends Migration
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('subfleets', function (Blueprint $table) {
|
|
|
|
$table->increments('id');
|
|
|
|
$table->integer('airline_id')->unsigned()->nullable();
|
|
|
|
$table->string('name');
|
|
|
|
$table->text('type');
|
2017-07-05 22:55:36 +08:00
|
|
|
$table->tinyInteger('fuel_type')->unsigned()->nullable();
|
2017-06-25 03:00:56 +08:00
|
|
|
$table->double('cargo_capacity', 19, 2)->nullable();
|
|
|
|
$table->double('fuel_capacity', 19, 2)->nullable();
|
|
|
|
$table->double('gross_weight', 19, 2)->nullable();
|
2017-06-23 09:55:45 +08:00
|
|
|
$table->timestamps();
|
|
|
|
$table->softDeletes();
|
|
|
|
});
|
|
|
|
|
2017-07-02 10:06:55 +08:00
|
|
|
Schema::create('subfleet_expenses', function(Blueprint $table) {
|
|
|
|
$table->integer('subfleet_id')->unsigned();
|
|
|
|
$table->string('name');
|
|
|
|
$table->decimal('cost', 19, 2)->unsigned();
|
|
|
|
|
|
|
|
$table->primary(['subfleet_id', 'name']);
|
|
|
|
});
|
|
|
|
|
2017-06-25 00:09:27 +08:00
|
|
|
Schema::create('subfleet_fare', function (Blueprint $table) {
|
|
|
|
$table->integer('subfleet_id')->unsigned();
|
|
|
|
$table->integer('fare_id')->unsigned();
|
|
|
|
$table->decimal('price', 19, 2)->nullable();
|
|
|
|
$table->decimal('cost', 19, 2)->nullable();
|
|
|
|
$table->integer('capacity')->nullable()->unsigned();
|
|
|
|
$table->timestamps();
|
|
|
|
|
|
|
|
$table->primary(['subfleet_id', 'fare_id']);
|
|
|
|
$table->index(['fare_id', 'subfleet_id']);
|
|
|
|
});
|
|
|
|
|
2017-06-24 06:37:51 +08:00
|
|
|
Schema::create('subfleet_flight', function(Blueprint $table) {
|
|
|
|
$table->integer('subfleet_id')->unsigned();
|
|
|
|
$table->integer('flight_id')->unsigned();
|
|
|
|
|
|
|
|
$table->primary(['subfleet_id', 'flight_id']);
|
|
|
|
$table->index(['flight_id', 'subfleet_id']);
|
|
|
|
});
|
|
|
|
|
2017-06-23 09:55:45 +08:00
|
|
|
Schema::create('subfleet_rank', function(Blueprint $table) {
|
2017-06-24 06:33:18 +08:00
|
|
|
$table->integer('rank_id')->unsigned();
|
|
|
|
$table->integer('subfleet_id')->unsigned();
|
2017-06-23 09:55:45 +08:00
|
|
|
$table->double('acars_pay', 19, 2)->unsigned()->nullable();
|
|
|
|
$table->double('manual_pay', 19, 2)->unsigned()->nullable();
|
|
|
|
|
2017-06-23 10:44:49 +08:00
|
|
|
$table->primary(['rank_id', 'subfleet_id']);
|
|
|
|
$table->index(['subfleet_id', 'rank_id']);
|
2017-06-23 09:55:45 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::drop('subfleets');
|
2017-07-02 10:06:55 +08:00
|
|
|
Schema::drop('subfleet_expenses');
|
|
|
|
Schema::drop('subfleet_fare');
|
2017-06-24 06:33:18 +08:00
|
|
|
Schema::drop('subfleet_flight');
|
2017-07-02 10:06:55 +08:00
|
|
|
Schema::drop('subfleet_rank');
|
2017-06-23 09:55:45 +08:00
|
|
|
}
|
|
|
|
}
|