<?php

use App\Models\Airport;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::table('user_actions', function (Blueprint $table) {
            $table->dropColumn('message');
            $table->string('type')->after('user_flight_id');
            $table->dropColumn('user_flight_id');
            $table->json('data')->after('type');
        });

        Airport::whereMunicipality('Fayetteville/Springdale/Rogers')->update(['municipality' => 'Fayetteville']);
    }

    public function down(): void
    {
        Schema::table('user_actions', function (Blueprint $table) {
            $table->dropColumn(['type', 'data']);
            $table->text('message')->after('user_flight_id');
        });
    }
};
