<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('jina_cache', function (Blueprint $table) {
            $table->id();
            $table->string('url_hash', 32)->unique(); // MD5 hash
            $table->text('url');
            $table->longText('content');
            $table->timestamp('extracted_at');
            $table->timestamp('expires_at')->index();

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

    public function down(): void
    {
        Schema::dropIfExists('jina_cache');
    }
};
