<?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::table('ocr_question_results', function (Blueprint $table) {
            // 添加答案验证字段
            $table->boolean('answer_verified')->nullable()->after('manual_answer')->comment('答案是否已验证');

            // 创建索引
            $table->index('answer_verified', 'idx_ocr_question_results_answer_verified');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('ocr_question_results', function (Blueprint $table) {
            // 删除索引
            $table->dropIndex('idx_ocr_question_results_answer_verified');

            // 删除字段
            $table->dropColumn('answer_verified');
        });
    }
};
