<?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('ai_tool_keywords', function (Blueprint $table) {
            $table->id();

            $table->foreignId('category_id');
            $table->foreignId('ai_tool_id');

            $table->string('value');
            $table->string('value_lowercased');

            $table->timestamps();

            $table->foreign('category_id')->references('id')->on('categories');
            $table->foreign('ai_tool_id')->references('id')->on('ai_tools');

            $table->index('ai_tool_id');
        });
    }

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