<?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('demand_rebate_trans', function (Blueprint $table) {
            $table->bigIncrements('DmdReb_ID');

            $table->unsignedBigInteger('Dmd_Id');
            $table->unsignedBigInteger('Reb_Id');

            $table->decimal('Applied_Amt', 10, 2);

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

            $table->foreign('Dmd_Id')
                ->references('Dmd_Id')
                ->on('trans_demand')
                ->onDelete('cascade');

            $table->foreign('Reb_Id')
                ->references('Reb_Id')
                ->on('rebate_master')
                ->onDelete('cascade');
        });
    }

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