<?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('hexling_badge_hexling_word', function (Blueprint $table) {
            $table->id();
            $table->foreignId('hexling_words_id')->constrained('hexling_words')->cascadeOnDelete();
            $table->foreignId('hexling_badges_id')->constrained('hexling_badges')->cascadeOnDelete();
            $table->timestamps();
            $table->unique(['hexling_words_id', 'hexling_badges_id'], 'badge_word_unique');
        });
    }

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