<?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('skill_project', function (Blueprint $table) {
            $table->id();
            $table->foreignId('skill_id')->constrained()->cascadeOnDelete();
            $table->foreignId('project_id')->constrained()->cascadeOnDelete();
            $table->integer('level_before');
            $table->integer('level_after');
            $table->string('level_description_key')->nullable();
            $table->timestamps();

            $table->unique(['skill_id', 'project_id']);
        });
    }

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