<?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('processing_penerimaan_bahan', function (Blueprint $table) {
            $table->id();
            $table->string('penerimaan_bahan_id')->unique();
            $table->date('document_date');
            $table->unsignedBigInteger('warehouse_id');
            $table->unsignedBigInteger('plan_id');
            $table->unsignedBigInteger('process_id');
            $table->unsignedBigInteger('pic');
            $table->decimal('print_number',20,0)->nullable();
            $table->string('created_by');
            $table->timestamp('created_at');
            $table->string('updated_by');
            $table->timestamp('updated_at');

            $table->foreign('process_id')->references('id')->on('process')->onDelete('restrict');
            $table->foreign('warehouse_id')->references('id')->on('warehouse')->onDelete('restrict');
        });
    }

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