<?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('tbl_komponen', function (Blueprint $table) {
            $table->id('id_komponen');
            $table->unsignedBigInteger('id_barang');
            $table->string('nama_komponen');
            $table->string('nomor_komponen')->nullable();
            $table->string('komponen_portion');
            $table->string('komponen_portion_from');
            $table->string('komponen_portion_to');
            $table->timestamps();
        });
        Schema::table('tbl_komponen', function (Blueprint $table) {
            $table->foreign('id_barang')->references('id_barang')->on('tbl_barang');
        });
    }

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