<?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::table('documents', function (Blueprint $table) {
            $table->string('preview_path', 2048)->nullable()->after('path');
            $table->string('preview_mime', 100)->nullable()->after('preview_path');
            $table->timestamp('preview_generated_at')->nullable()->after('preview_mime');
        });
    }

    public function down(): void
    {
        Schema::table('documents', function (Blueprint $table) {
            $table->dropColumn(['preview_path', 'preview_mime', 'preview_generated_at']);
        });
    }
};
