<?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('scheduled_visits') && !Schema::hasColumn('scheduled_visits', 'status')) {
            Schema::table('scheduled_visits', function (Blueprint $table) {
                $table->string('status', 50)->default('Scheduled')->after('colline');
            });
        }
    }

    public function down(): void
    {
        if (Schema::hasColumn('scheduled_visits', 'status')) {
            Schema::table('scheduled_visits', function (Blueprint $table) {
                $table->dropColumn('status');
            });
        }
    }
};
