Files
alliance-services/database/migrations/2026_03_10_025605_create_srp_tables.php
2026-03-10 02:10:28 -05:00

167 lines
4.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('srp_ships')) {
Schema::create('srp_ships', function (Blueprint $table) {
$table->increments('id');
$table->string('character_id')->default('N/A');
$table->string('character_name');
$table->string('fleeet_commander_id')->default('0');
$table->string('fleet_commander_name');
$table->string('zkillboard');
$table->string('ship_type');
$table->enum('fleet_type', [
'Home Defense',
'Fun Fleet',
'ADM Fleet',
'Casuals',
'Strat Op',
'CTA',
'None',
]);
$table->decimal('loss_value', 20, 2);
$table->enum('approval', [
'Under Review',
'Approved',
'Denied',
]);
$table->decimal('paid_value', 20, 2);
$table->text('notes')->nullable();
$table->string('paid_by_id')->nullable();
$table->string('paid_by_name')->nullable();
});
}
if(!Schema::hasTable('srp_ship_types')) {
Schema::create('srp_ship_types', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->string('description');
});
}
if(!Schema::hasTable('srp_payouts')) {
Schema::create('srp_payouts', function (Blueprint $table) {
$table->increments('id');
$table->string('code');
$table->decimal('payout', 5, 2);
});
}
DB::table('srp_ship_types')->insert([
'code' => 'None',
'description' => 'None',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T1FDC',
'description' => 'T1 Frig / Dessie / Cruiser',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T1BC',
'description' => 'T1 Battelcruiser',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T2F',
'description' => 'T2 Frigate',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T3D',
'description' => 'T3 Destroyer',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T1T2Logi',
'description' => 'T1 & T2 Logistics',
]);
DB::table('srp_ship_types')->insert([
'code' => 'RI',
'description' => 'Recons / Interdictors',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T2C',
'description' => 'T2 Cruiser',
]);
DB::table('srp_ship_types')->insert([
'code' => 'T3C',
'description' => 'T3 Cruiser',
]);
DB::table('srp_ship_types')->insert([
'code' => 'COM',
'description' => 'Command Ship',
]);
DB::table('srp_payouts')->insert([
'code' => 'T1FDC',
'payout' => 75.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'T1BC',
'payout' => 60.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'T2F',
'payout' => 60.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'T3D',
'payout' => 60.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'T1T2Logi',
'payout' => 100.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'RI',
'payout' => 50.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'T2C',
'payout' => 50.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'T3C',
'payout' => 50.00,
]);
DB::table('srp_payouts')->insert([
'code' => 'COM',
'payout' => 100.00,
]);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('srp_payouts');
Schema::dropIfExists('srp_ships');
Schema::dropIfExists('srp_ship_types');
}
};