rename flight subfleet join table
This commit is contained in:
@@ -73,6 +73,15 @@ class CreateFlightTables extends Migration
|
||||
|
||||
$table->index('flight_id');
|
||||
});
|
||||
|
||||
Schema::create('flight_subfleet', function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->unsignedInteger('subfleet_id');
|
||||
$table->string('flight_id', \App\Interfaces\Model::ID_MAX_LENGTH);
|
||||
|
||||
$table->index(['subfleet_id', 'flight_id']);
|
||||
$table->index(['flight_id', 'subfleet_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -84,6 +93,7 @@ class CreateFlightTables extends Migration
|
||||
{
|
||||
Schema::drop('flight_fields');
|
||||
Schema::drop('flight_fare');
|
||||
Schema::drop('flight_subfleet');
|
||||
Schema::drop('flights');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,14 +35,6 @@ class CreateSubfleetTables extends Migration
|
||||
$table->index(['fare_id', 'subfleet_id']);
|
||||
});
|
||||
|
||||
Schema::create('subfleet_flight', function (Blueprint $table) {
|
||||
$table->unsignedInteger('subfleet_id');
|
||||
$table->string('flight_id', 12);
|
||||
|
||||
$table->primary(['subfleet_id', 'flight_id']);
|
||||
$table->index(['flight_id', 'subfleet_id']);
|
||||
});
|
||||
|
||||
Schema::create('subfleet_rank', function (Blueprint $table) {
|
||||
$table->unsignedInteger('rank_id');
|
||||
$table->unsignedInteger('subfleet_id');
|
||||
@@ -63,7 +55,6 @@ class CreateSubfleetTables extends Migration
|
||||
{
|
||||
Schema::dropIfExists('subfleets');
|
||||
Schema::dropIfExists('subfleet_fare');
|
||||
Schema::dropIfExists('subfleet_flight');
|
||||
Schema::dropIfExists('subfleet_rank');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,6 +175,6 @@ class Flight extends Model
|
||||
|
||||
public function subfleets()
|
||||
{
|
||||
return $this->belongsToMany(Subfleet::class, 'subfleet_flight');
|
||||
return $this->belongsToMany(Subfleet::class, 'flight_subfleet');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ use App\Models\Traits\ExpensableTrait;
|
||||
|
||||
/**
|
||||
* Class Subfleet
|
||||
* @property int id
|
||||
* @property string type
|
||||
* @property string ground_handling_multiplier
|
||||
* @package App\Models
|
||||
@@ -81,7 +82,7 @@ class Subfleet extends Model
|
||||
|
||||
public function flights()
|
||||
{
|
||||
return $this->belongsToMany(Flight::class, 'subfleet_flight');
|
||||
return $this->belongsToMany(Flight::class, 'flight_subfleet');
|
||||
}
|
||||
|
||||
public function ranks()
|
||||
|
||||
Reference in New Issue
Block a user