<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        if (! Schema::hasTable('passenger_extra_services')) {
            return;
        }
        Schema::table('passenger_extra_services', function (Blueprint $table) {
            if (! Schema::hasColumn('passenger_extra_services', 'image_path')) {
                $table->string('image_path', 512)->nullable()->after('description');
            }
        });
    }

    public function down(): void
    {
        if (! Schema::hasTable('passenger_extra_services')) {
            return;
        }
        Schema::table('passenger_extra_services', function (Blueprint $table) {
            if (Schema::hasColumn('passenger_extra_services', 'image_path')) {
                $table->dropColumn('image_path');
            }
        });
    }
};
