<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        DB::statement("ALTER TABLE material_transfer_request_items MODIFY COLUMN approval_status ENUM('pending', 'approved', 'rejected', 'modified', 'partially_approved', 'not_approved', 'partial') DEFAULT 'pending'");
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        // First update any 'partial' values to 'partially_approved' before changing the enum
        DB::statement("UPDATE material_transfer_request_items SET approval_status = 'partially_approved' WHERE approval_status = 'partial'");

        DB::statement("ALTER TABLE material_transfer_request_items MODIFY COLUMN approval_status ENUM('pending', 'approved', 'rejected', 'modified', 'partially_approved', 'not_approved') DEFAULT 'pending'");
    }
};