<?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::create('pay_matrix_master', function (Blueprint $table) {
            $table->bigIncrements('PMM_Id');
            $table->unsignedBigInteger('EGM_id')->nullable();
            $table->integer('Cell_Index');
            $table->decimal('Basic_Pay', 10, 2);
            $table->timestamps();
            $table->softDeletes();

            $table->foreign('EGM_id')
                  ->references('EGM_Id')
                  ->on('emp_grade_master')
                  ->onDelete('restrict')
                  ->onUpdate('cascade');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('pay_matrix_master');
    }
};
