<?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('raw_material_items', function (Blueprint $table) {
            if (!Schema::hasColumn('raw_material_items', 'current_stock'))
                $table->double('current_stock')->default(0)->nullable();
            if (!Schema::hasColumn('raw_material_items', 'avg_unit_price'))
                $table->double('avg_unit_price')->default(0)->nullable();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('raw_material_items', function (Blueprint $table) {
            //
        });
    }
};
