<?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::hasColumn('credit_requests', 'seed_id')) {
            Schema::table('credit_requests', function (Blueprint $table) {
                $table->unsignedInteger('seed_id')->nullable()->after('guarantee_type');
            });
        }
    }

    public function down(): void
    {
        Schema::table('credit_requests', function (Blueprint $table) {
            $table->dropColumn('seed_id');
        });
    }
};
