<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('technician_consumables', function (Blueprint $table) {

            // kalau sebelumnya status belum ada
            $table->enum('status', [
                'assigned',
                'used',
                'returned',
                'lost',
                'damaged'
            ])->default('assigned')->after('qty_remaining');

            $table->index('status');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('technician_consumables', function (Blueprint $table) {
            $table->dropIndex(['status']);
            $table->dropColumn('status');
        });
    }
};
