<?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('rss_post_keywords', function (Blueprint $table) {
            $table->id();
            $table->foreignId('rss_post_id');
            $table->enum('type', ['keyword', 'entity']);
            $table->boolean('is_main')->default(false);
            $table->string('value');
            $table->string('value_lowercased');
            $table->timestamps();

            $table->foreign('rss_post_id')->references('id')->on('rss_posts');

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

        });
    }

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