<?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('personality_result', function (Blueprint $table) {
            $table->id();
            $table->uuid('result_id');
            $table->uuid('personality_id');
            $table->timestamps();

            $table->foreign('result_id')->references('id')->on('results')->cascadeOnDelete();
            $table->foreign('personality_id')->references('id')->on('personalities')->cascadeOnDelete();
        });
    }

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