<?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('kylin_word_filter_versions', function (Blueprint $table) {
            $table->id();
            $table->string('version', 30)->unique()->comment('版本号');
            $table->unsignedInteger('total_words')->default(0)->comment('总词数');
            $table->json('category_stats')->nullable()->comment('分类统计');
            $table->string('checksum', 128)->nullable()->comment('校验和');
            $table->string('change_summary')->nullable()->comment('变更摘要');
            $table->timestamp('published_at')->nullable()->comment('发布时间');
            $table->timestamps();
            $table->softDeletes();

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

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