<?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_sub_kategori', function (Blueprint $table) {
            $table->id('id_sub_kategori');
            $table->unsignedBigInteger('id_kategori');
            $table->string('nama_sub_kategori');
            $table->string('nomor_sub_kategori')->nullable();
            $table->string('sub_kategori_portion');
            $table->string('sub_kategori_portion_from');
            $table->string('sub_kategori_portion_to');
            $table->timestamps();
        });
        Schema::table('tbl_sub_kategori', function (Blueprint $table) {
            $table->foreign('id_kategori')->references('id_kategori')->on('tbl_kategori');
        });
    }

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