<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up()
    {
        Schema::table('attn_regularize', function (Blueprint $table) {

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

            $table->foreign('R_Status')
                  ->references('Act_Id')
                  ->on('action_master')
                  ->onDelete('set null');
        });
    }

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

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