<?php

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

return new class extends Migration
{
    public function up(): void
    {
        if (Schema::hasTable('barang_rusak') && ! Schema::hasColumn('barang_rusak', 'admin_note')) {
            Schema::table('barang_rusak', function (Blueprint $table) {
                $table->text('admin_note')->nullable()->after('keterangan');
            });
        }
    }

    public function down(): void
    {
        if (Schema::hasTable('barang_rusak') && Schema::hasColumn('barang_rusak', 'admin_note')) {
            Schema::table('barang_rusak', function (Blueprint $table) {
                $table->dropColumn('admin_note');
            });
        }
    }
};
