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

            $table->bigIncrements('TET_Id');

            $table->date('TET_Date');

            $table->unsignedBigInteger('SL_Id');
            $table->unsignedBigInteger('TE_Id');

            $table->decimal('EMD_Amt', 15, 2);

            $table->unsignedBigInteger('TET_HOD');

            $table->timestamp('TET_HDT')->nullable();

            $table->string('TET_CD')->nullable();
            $table->string('TET_BillNo')->nullable();

            $table->timestamps();
            $table->softDeletes();

            // FK
            $table->foreign('SL_Id')->references('SL_Id')->on('subledg_master');
            $table->foreign('TE_Id')->references('TE_Id')->on('tender_entry');
            $table->foreign('TET_HOD')->references('Usr_Id')->on('user_master');
        });
    }

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