<?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('ms_tabel_data_kolom', function (Blueprint $table) {
            $table->id('MsTabelDataKolomId');
            $table->integer('ms_tabel_data_id');
            $table->string('name')->nullable();
            $table->string('key')->nullable();
            $table->string('order')->nullable();
            $table->integer('status')->default(1);
            $table->timestampsTz();
            $table->softdeletesTz();

            $table->foreign('ms_tabel_data_id')->references('MsTabelDataId')->on('ms_tabel_data')->cascadeOnDelete();
        });
    }

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