<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('other_debt_rnd_do', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('other_debt_rnd_detail_id');
            $table->unsignedBigInteger('delivery_order_id');
            $table->unsignedBigInteger('created_by')->nullable();
            $table->unsignedBigInteger('updated_by')->nullable();
            $table->timestamps();

            $table->foreign('other_debt_rnd_detail_id')->references('id')->on('other_debt_rnd_details')->onDelete('restrict');
            $table->foreign('delivery_order_id')->references('id')->on('delivery_orders')->onDelete('restrict');
            $table->foreign('created_by')->references('id')->on('users')->onDelete('restrict');
            $table->foreign('updated_by')->references('id')->on('users')->onDelete('restrict');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('other_debt_rnd_do');
    }
};
