Files
FlightsAPI/database/migrations/2026_04_05_025209_create_extra_tables.php
2026-04-05 15:06:27 +10:00

59 lines
1.8 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('flight_classes', function (Blueprint $table) {
$table->unsignedTinyInteger('id')->primary();
$table->string('name');
});
Schema::create('seat_types', function (Blueprint $table) {
$table->unsignedTinyInteger('id')->primary();
$table->string('name');
});
Schema::create('flight_reasons', function (Blueprint $table) {
$table->unsignedTinyInteger('id')->primary();
$table->string('name');
});
DB::table('flight_classes')->insert([
['id' => 0, 'name' => 'Unspecified'],
['id' => 1, 'name' => 'Economy'],
['id' => 2, 'name' => 'Business'],
['id' => 3, 'name' => 'First'],
['id' => 4, 'name' => 'Premium Economy'],
['id' => 5, 'name' => 'Private'],
]);
DB::table('seat_types')->insert([
['id' => 0, 'name' => 'Unspecified'],
['id' => 1, 'name' => 'Window'],
['id' => 2, 'name' => 'Middle'],
['id' => 3, 'name' => 'Aisle'],
]);
DB::table('flight_reasons')->insert([
['id' => 0, 'name' => 'No Particular Reason'],
['id' => 1, 'name' => 'Pleasure'],
['id' => 2, 'name' => 'Business'],
['id' => 3, 'name' => 'Crew'],
['id' => 4, 'name' => 'Other'],
]);
}
public function down(): void
{
Schema::dropIfExists('flight_reasons');
Schema::dropIfExists('seat_types');
Schema::dropIfExists('flight_classes');
}
};