<?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('news_serp_results', function (Blueprint $table) {
            $table->id();
            $table->foreignId('category_id')->nullable();
            $table->string('category_name')->nullable();
            $table->string('serp_provider');
            $table->string('serp_se');
            $table->string('serp_se_type');
            $table->string('serp_keyword');
            $table->string('serp_country_iso');
            $table->decimal('serp_cost')->nullable();
            $table->unsignedInteger('result_count')->nullable();
            $table->string('filename');
            $table->enum('status', ['initial'/* other potential statuses */]);
            $table->timestamps();

            $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
        });
    }

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