<?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('rejection_return_notes', function (Blueprint $table) {
            if (Schema::hasColumn('rejection_return_notes', 'supplier_bill_no'))
                $table->string('supplier_bill_no')->nullable()->change();
            
            if (!Schema::hasColumn('rejection_return_notes', 'type'))
                $table->string('type')->nullable();

            if (!Schema::hasColumn('rejection_return_notes', 'is_production'))
                $table->boolean('is_production')->default(false);
        });
    }

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