<?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
    {
        Schema::table('field_job_settings', function (Blueprint $table) {
            $table->foreignId('cancel_decision_id')
                ->nullable()
                ->after('complete_decision_id')
                ->constrained('decisions')
                ->nullOnDelete();
        });
    }

    public function down(): void
    {
        Schema::table('field_job_settings', function (Blueprint $table) {
            $table->dropForeign(['cancel_decision_id']);
            $table->dropColumn('cancel_decision_id');
        });
    }
};
