<?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('job_offer_specialisations', function (Blueprint $table) {
            $table->unsignedBigInteger('job_offer_id');
            $table->unsignedBigInteger('user_profile_specialisation_id');
            $table->unsignedInteger('position')->nullable();

            $table->foreign('job_offer_id')->references('id')
                ->on('job_offers')->onDelete('CASCADE')->onUpdate('CASCADE');

            $table->foreign('user_profile_specialisation_id')->references('id')
                ->on('user_profile_specialisations')->onDelete('CASCADE')->onUpdate('CASCADE');
        });
    }

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