schema tightening

This commit is contained in:
Nabeel Shahzad 2017-06-23 17:37:51 -05:00
parent c3e417429a
commit ac37a93641
2 changed files with 9 additions and 9 deletions

View File

@ -9,7 +9,7 @@ class CreateAircraftsTable extends Migration
{ {
Schema::create('aircraft', function (Blueprint $table) { Schema::create('aircraft', function (Blueprint $table) {
$table->increments('id'); $table->increments('id');
$table->integer('subfleet_id')->unsigned()->nullable(); $table->integer('subfleet_id')->unsigned();
$table->string('hex_code')->nullable(); $table->string('hex_code')->nullable();
$table->string('icao'); $table->string('icao');
$table->string('name'); $table->string('name');

View File

@ -22,6 +22,14 @@ class CreateSubfleetsTable extends Migration
$table->softDeletes(); $table->softDeletes();
}); });
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']);
});
Schema::create('subfleet_rank', function(Blueprint $table) { Schema::create('subfleet_rank', function(Blueprint $table) {
$table->integer('rank_id')->unsigned(); $table->integer('rank_id')->unsigned();
$table->integer('subfleet_id')->unsigned(); $table->integer('subfleet_id')->unsigned();
@ -31,14 +39,6 @@ class CreateSubfleetsTable extends Migration
$table->primary(['rank_id', 'subfleet_id']); $table->primary(['rank_id', 'subfleet_id']);
$table->index(['subfleet_id', 'rank_id']); $table->index(['subfleet_id', 'rank_id']);
}); });
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']);
});
} }
/** /**