<?php

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

return new class extends Migration
{
   public function up()
    {
        Schema::table('over_time_records', function (Blueprint $table) {

            // ❌ Remove old column
            $table->dropColumn('Work_Extension_Type');

            // ✅ Add new columns
            $table->enum('Early_Coming', ['Y', 'N'])
                  ->nullable()
                  ->default('N')
                  ->after('Out_Time');

            $table->enum('Late_Going', ['Y', 'N'])
                  ->nullable()
                  ->default('N')
                  ->after('Early_Coming');
        });
    }

    public function down()
    {
        Schema::table('over_time_records', function (Blueprint $table) {

            // ❌ Remove new columns
            $table->dropColumn(['Early_Coming', 'Late_Going']);

            // ✅ Restore old column
            $table->enum('Work_Extension_Type', ['EARLY_COMING', 'LATE_GOING'])
                  ->nullable()
                  ->after('Out_Time');
        });
    }
};
