<?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('salary_grades', function (Blueprint $table) {
            $table->id();
            $table->foreignId('salary_structure_id')->constrained('salary_structures')->cascadeOnDelete();
            $table->string('code');          // GL01..GL17
            $table->string('name')->nullable();
            $table->timestamps();

            $table->unique(['salary_structure_id', 'code']);
        });
    }

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