<?php

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

return new class extends Migration
{
    /**
     * Widen staff.status so values like probation / terminated persist (MySQL ENUM is often too strict).
     */
    public function up(): void
    {
        if (!Schema::hasTable('staff')) {
            return;
        }

        $driver = Schema::getConnection()->getDriverName();
        if ($driver === 'mysql') {
            DB::statement("ALTER TABLE `staff` MODIFY `status` VARCHAR(32) NOT NULL DEFAULT 'active'");
        }
    }

    public function down(): void
    {
        // Intentionally left blank: reverting ENUM requires knowing original definition.
    }
};
