foreign keys for alliance moon rental tables

This commit is contained in:
2021-05-30 20:01:38 +09:00
parent 30ea561714
commit f78b9eddb9

View File

@@ -28,7 +28,7 @@ class CreateNewMoonRentalTables extends Migration
if(!Schema::hasTable('alliance_moons')) {
Schema::create('alliance_moons', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('moon_id')->unique();
$table->unsignedBigInteger('moon_id');
$table->string('name')->default('Not Assigned');
$table->unsignedBigInteger('system_id');
$table->string('system_name')->default('Not Assigned');
@@ -46,20 +46,22 @@ class CreateNewMoonRentalTables extends Migration
Schema::create('alliance_moon_ores', function (Blueprint $table) {
$table->id();
$table->unsignedBigInteger('moon_id');
$table->foreign('moon_id')
->references('moon_id')
->on('alliance_moons')
->cascadeOnDelete();
$table->string('moon_name');
$table->foreign('moon_name')
->references('moon_name')
->on('alliance_moons')
->cascadeOnDelete();
$table->unsignedBigInteger('ore_type_id');
$table->string('ore_name');
$table->float('quantity');
$table->unsignedBigInteger('solar_system_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();
});
}