<?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_categories', function (Blueprint $table) {
            $table->id();
            $table->string('code', 50)->unique()->comment('分类代码');
            $table->string('name', 100)->comment('分类名称');
            $table->string('risk_level', 10)->comment('风险等级: high/medium');
            $table->string('description')->nullable()->comment('分类描述');
            $table->unsignedInteger('word_count')->default(0)->comment('词数统计');
            $table->timestamps();
            $table->softDeletes();

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

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