<?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('deskripsi_kompetensi_jenjang', function (Blueprint $table) {
            $table->id();
            $table->foreignId('kompetensi_id')->constrained('kompetensi')->cascadeOnDelete();
            $table->foreignId('jenjang_jabatan_id')->constrained('jenjang_jabatan')->cascadeOnDelete();
            $table->text('deskripsi')->nullable();
            $table->timestamps();

            $table->unique(['kompetensi_id', 'jenjang_jabatan_id'], 'kompetensi_jenjang_unique');
        });
    }

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