<?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('property_assessments', function (Blueprint $table) {

            $table->unsignedBigInteger('R_Status')
                  ->nullable()
                  ->after('Status');

            $table->text('Status_Remarks')
                  ->nullable()
                  ->after('R_Status');

            $table->foreign('R_Status')
                  ->references('Act_Id')
                  ->on('action_master')
                  ->nullOnDelete();

        });
    }

    public function down(): void
    {
        Schema::table('property_assessments', function (Blueprint $table) {

            $table->dropForeign(['R_Status']);

            $table->dropColumn([
                'R_Status',
                'Status_Remarks'
            ]);

        });
    }
};
