Files
alliance-services/database/migrations/2026_03_10_025710_create_lookup_tables.php
2026-03-15 18:20:12 -05:00

145 lines
5.6 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
if(!Schema::hasTable('moon_lookup')) {
Schema::create('moon_lookup', function (Blueprint $table) {
$table->id();
$table->string('moon_id');
$table->string('moon_name');
$table->double('position_x');
$table->double('position_y');
$table->double('position_z');
$table->string('sov_owner_id')->nullable();
$table->string('sov_owner_name')->nullable();
$table->string('system_id');
$table->string('system_name');
$table->enum('moon_type', [
'Common',
'R4',
'R8',
'R16',
'R32',
'R64',
'None',
])->default('None');
$table->decimal('worth', 20, 2)->default(0.00);
$table->enum('owned', [
'alliance',
'corporation',
'character'
]);
$table->string('owner_id');
$table->string('owner_name');
$table->decimal('rental_amount')->default(0.00);
$table->timestamps();
});
}
if(!Schema::hasTable('item_lookup')) {
Schema::create('item_lookup', function (Blueprint $table) {
$table->string('item_id')->unique();
$table->double('capacity', 20, 2)->nullable();
$table->text('description');
$table->unsignedBigInteger('graphic_id')->nullable();
$table->unsignedBigInteger('group_id');
$table->unsignedBigInteger('icon_id')->nullable();
$table->unsignedBigInteger('market_group_id')->nullable();
$table->string('mass')->nullable();
$table->string('name');
$table->double('packaged_volume', 20, 2)->nullable();
$table->unsignedBigInteger('portion_size')->nullable();
$table->boolean('published');
$table->double('radius', 20, 2)->nullable();
$table->unsignedBigInteger('type_id')->unique();
$table->double('volume', 20, 2)->nullable();
});
}
if(!Schema::hasTable('character_lookup')) {
Schema::create('character_lookup', function (Blueprint $table) {
$table->string('character_id');
$table->string('alliance_id')->nullable();
$table->string('ancestry_id')->nullable();
$table->string('birthday');
$table->string('bloodline_id');
$table->string('corporation_id');
$table->string('description')->nullable();
$table->string('faction_id')->nullable();
$table->string('gender');
$table->string('name');
$table->string('race_id');
$table->float('security_status');
$table->string('title')->nullable();
});
}
if(!Schema::hasTable('corporation_lookup')) {
Schema::create('corporation_lookup', function (Blueprint $table) {
$table->string('corporation_id')->unique();
$table->string('alliance_id')->nullable();
$table->string('ceo_id');
$table->string('creator_id');
$table->string('date_founded')->nullable();
$table->string('description')->nullable();
$table->string('faction_id')->nullable();
$table->string('home_station_id')->nullable();
$table->string('member_count');
$table->string('name');
$table->string('shares')->nullable();
$table->decimal('tax_rate', 20, 2);
$table->string('ticker');
$table->string('url')->nullable();
$table->enum('war_eligible', [
'Yes',
'No',
])->default('No');
});
}
if(!Schema::hasTable('alliance_lookup')) {
Schema::create('alliance_lookup', function (Blueprint $table) {
$table->string('alliance_id')->unique();
$table->string('creator_corporation_id');
$table->string('creator_id');
$table->dateTime('date_founded');
$table->string('executor_corporation_id')->nullable();
$table->string('faction_id')->nullable();
$table->string('name');
$table->string('ticker');
});
}
if(!Schema::hasTable('solar_systems')) {
Schema::create('solar_systems', function(Blueprint $table) {
$table->id();
$table->string('name');
$table->unsignedBigInteger('solar_system_id');
});
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('moon_lookup');
Schema::dropIfExists('item_lookup');
Schema::dropIfExists('character_lookup');
Schema::dropIfExists('corporation_lookup');
Schema::dropIfExists('alliance_lookup');
Schema::dropIfExists('solar_systems');
}
};