<?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('agent_statuses', function (Blueprint $table) {
            $table->dropForeign(['solicitor_id']);
        });

        Schema::table('agent_statuses', function (Blueprint $table) {
            $table->unsignedBigInteger('solicitor_id')->nullable()->change();
        });

        Schema::table('agent_statuses', function (Blueprint $table) {
            $table->foreign('solicitor_id')
                ->references('id')
                ->on('solicitors')
                ->nullOnDelete();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        //
    }
};
