<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('assessment_pengembangan', function (Blueprint $table) {
            $table->id();
            $table->foreignId('pegawai_id')->constrained('pegawai')->cascadeOnDelete();
            $table->unsignedSmallInteger('periode_tahun');
            $table->boolean('dikembangkan_karier')->default(false);
            $table->boolean('dikembangkan_kompetensi')->default(false);
            $table->timestamps();

            $table->unique(['pegawai_id', 'periode_tahun'], 'assessment_pengembangan_pegawai_periode_unique');
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('assessment_pengembangan');
    }
};
