<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     * Add permission to the status enum column
     */
    public function up(): void
    {
        DB::statement("ALTER TABLE attendances MODIFY COLUMN status ENUM('present', 'late', 'early_leave', 'absent', 'leave', 'sick', 'permission') NOT NULL DEFAULT 'present'");
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        // Note: This will fail if there are records with permission status
        DB::statement("ALTER TABLE attendances MODIFY COLUMN status ENUM('present', 'late', 'early_leave', 'absent', 'leave', 'sick') NOT NULL DEFAULT 'present'");
    }
};
