This commit is contained in:
Nabeel Shahzad 2017-06-22 21:44:49 -05:00
parent b423b66963
commit b9d49a4af9
5 changed files with 21 additions and 10 deletions

View File

@ -14,7 +14,7 @@ class CreateUsersTable extends Migration
public function up() public function up()
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->increments('id'); $table->uuid('id');
$table->string('name')->nullable(); $table->string('name')->nullable();
$table->string('email')->unique(); $table->string('email')->unique();
$table->string('password'); $table->string('password');
@ -22,7 +22,7 @@ class CreateUsersTable extends Migration
$table->integer('rank_id')->nullable()->unsigned(); $table->integer('rank_id')->nullable()->unsigned();
$table->integer('home_airport_id')->nullable()->unsigned(); $table->integer('home_airport_id')->nullable()->unsigned();
$table->integer('curr_airport_id')->nullable()->unsigned(); $table->integer('curr_airport_id')->nullable()->unsigned();
$table->bigInteger('last_pirep_id')->nullable()->unsigned(); $table->uuid('last_pirep_id')->nullable();
$table->bigInteger('flights')->nullable()->unsigned(); $table->bigInteger('flights')->nullable()->unsigned();
$table->bigInteger('flight_time')->nullable()->unsigned(); $table->bigInteger('flight_time')->nullable()->unsigned();
$table->decimal('balance', 19, 2)->nullable(); $table->decimal('balance', 19, 2)->nullable();
@ -31,6 +31,8 @@ class CreateUsersTable extends Migration
$table->rememberToken(); $table->rememberToken();
$table->timestamps(); $table->timestamps();
$table->softDeletes(); $table->softDeletes();
$table->primary('id');
}); });
// Create table for storing roles // Create table for storing roles
@ -44,7 +46,7 @@ class CreateUsersTable extends Migration
// Create table for associating roles to users (Many-to-Many) // Create table for associating roles to users (Many-to-Many)
Schema::create('role_user', function (Blueprint $table) { Schema::create('role_user', function (Blueprint $table) {
$table->integer('user_id')->unsigned(); $table->uuid('user_id');
$table->integer('role_id')->unsigned(); $table->integer('role_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users') $table->foreign('user_id')->references('id')->on('users')
@ -53,6 +55,7 @@ class CreateUsersTable extends Migration
->onUpdate('cascade')->onDelete('cascade'); ->onUpdate('cascade')->onDelete('cascade');
$table->primary(['user_id', 'role_id']); $table->primary(['user_id', 'role_id']);
$table->index(['role_id', 'user_id']);
}); });
// Create table for storing permissions // Create table for storing permissions

View File

@ -26,13 +26,15 @@ class CreateFaresTable extends Migration
}); });
Schema::create('aircraft_fare', function (Blueprint $table) { Schema::create('aircraft_fare', function (Blueprint $table) {
$table->increments('id');
$table->integer('aircraft_id')->unsigned(); $table->integer('aircraft_id')->unsigned();
$table->integer('fare_id')->unsigned(); $table->integer('fare_id')->unsigned();
$table->decimal('price', 19, 2)->nullable(); $table->decimal('price', 19, 2)->nullable();
$table->decimal('cost', 19, 2)->nullable(); $table->decimal('cost', 19, 2)->nullable();
$table->integer('capacity')->nullable()->unsigned(); $table->integer('capacity')->nullable()->unsigned();
$table->timestamps(); $table->timestamps();
$table->primary(['aircraft_id', 'fare_id']);
$table->index(['fare_id', 'aircraft_id']);
}); });
} }

View File

@ -14,7 +14,7 @@ class CreateFlightsTable extends Migration
public function up() public function up()
{ {
Schema::create('flights', function (Blueprint $table) { Schema::create('flights', function (Blueprint $table) {
$table->increments('id'); $table->uuid('id');
$table->integer('airline_id')->unsigned(); $table->integer('airline_id')->unsigned();
$table->text('flight_number'); $table->text('flight_number');
$table->text('route_code')->nullable(); $table->text('route_code')->nullable();
@ -29,6 +29,8 @@ class CreateFlightsTable extends Migration
$table->boolean('active')->default(true); $table->boolean('active')->default(true);
$table->timestamps(); $table->timestamps();
$table->primary('id');
$table->unique('flight_number'); $table->unique('flight_number');
$table->index('flight_number'); $table->index('flight_number');
@ -37,9 +39,11 @@ class CreateFlightsTable extends Migration
}); });
Schema::create('flight_aircraft', function ($table) { Schema::create('flight_aircraft', function ($table) {
$table->increments('id'); $table->uuid('flight_id');
$table->integer('flight_id')->unsigned();
$table->integer('aircraft_id')->unsigned(); $table->integer('aircraft_id')->unsigned();
$table->primary(['flight_id', 'aircraft_id']);
$table->index(['aircraft_id', 'flight_id']);
}); });
} }

View File

@ -23,12 +23,13 @@ class CreateSubfleetsTable extends Migration
}); });
Schema::create('subfleet_rank', function(Blueprint $table) { Schema::create('subfleet_rank', function(Blueprint $table) {
$table->increments('id');
$table->integer('subfleet_id')->unsigned()->nullable();
$table->integer('rank_id')->unsigned()->nullable(); $table->integer('rank_id')->unsigned()->nullable();
$table->integer('subfleet_id')->unsigned()->nullable();
$table->double('acars_pay', 19, 2)->unsigned()->nullable(); $table->double('acars_pay', 19, 2)->unsigned()->nullable();
$table->double('manual_pay', 19, 2)->unsigned()->nullable(); $table->double('manual_pay', 19, 2)->unsigned()->nullable();
$table->primary(['rank_id', 'subfleet_id']);
$table->index(['subfleet_id', 'rank_id']);
}); });
} }

View File

@ -132,7 +132,8 @@ aircraft_fare:
capacity: 10 capacity: 10
flights: flights:
- airline_id: 1 - id: 1
airline_id: 1
flight_number: 100 flight_number: 100
dpt_airport_id: 1 dpt_airport_id: 1
arr_airport_id: 2 arr_airport_id: 2