foreign keys for alliance moon rental tables
This commit is contained in:
@@ -28,7 +28,7 @@ class CreateNewMoonRentalTables extends Migration
|
|||||||
if(!Schema::hasTable('alliance_moons')) {
|
if(!Schema::hasTable('alliance_moons')) {
|
||||||
Schema::create('alliance_moons', function (Blueprint $table) {
|
Schema::create('alliance_moons', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('moon_id')->unique();
|
$table->unsignedBigInteger('moon_id');
|
||||||
$table->string('name')->default('Not Assigned');
|
$table->string('name')->default('Not Assigned');
|
||||||
$table->unsignedBigInteger('system_id');
|
$table->unsignedBigInteger('system_id');
|
||||||
$table->string('system_name')->default('Not Assigned');
|
$table->string('system_name')->default('Not Assigned');
|
||||||
@@ -46,20 +46,22 @@ class CreateNewMoonRentalTables extends Migration
|
|||||||
Schema::create('alliance_moon_ores', function (Blueprint $table) {
|
Schema::create('alliance_moon_ores', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->unsignedBigInteger('moon_id');
|
$table->unsignedBigInteger('moon_id');
|
||||||
$table->foreign('moon_id')
|
|
||||||
->references('moon_id')
|
|
||||||
->on('alliance_moons')
|
|
||||||
->cascadeOnDelete();
|
|
||||||
$table->string('moon_name');
|
$table->string('moon_name');
|
||||||
$table->foreign('moon_name')
|
|
||||||
->references('moon_name')
|
|
||||||
->on('alliance_moons')
|
|
||||||
->cascadeOnDelete();
|
|
||||||
$table->unsignedBigInteger('ore_type_id');
|
$table->unsignedBigInteger('ore_type_id');
|
||||||
$table->string('ore_name');
|
$table->string('ore_name');
|
||||||
$table->float('quantity');
|
$table->float('quantity');
|
||||||
$table->unsignedBigInteger('solar_system_id');
|
$table->unsignedBigInteger('solar_system_id');
|
||||||
$table->unsignedBigInteger('planet_id');
|
$table->unsignedBigInteger('planet_id');
|
||||||
|
|
||||||
|
$table->foreign('moon_id')
|
||||||
|
->references('moon_id')
|
||||||
|
->on('alliance_moons')
|
||||||
|
->cascadeOnDelete();
|
||||||
|
|
||||||
|
$table->foreign('moon_name')
|
||||||
|
->references('name')
|
||||||
|
->on('alliance_moons')
|
||||||
|
->cascadeOnDelete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user