<?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::create('system_settings', function (Blueprint $table) {
            $table->id();
            $table->string('key', 255)->unique()->comment('配置键');
            $table->json('value')->comment('配置值');
            $table->string('group', 100)->comment('配置分组');
            $table->text('description')->nullable()->comment('配置说明');
            $table->boolean('is_public')->default(false)->comment('是否公开');
            $table->timestamps();
            
            // 添加索引
            $table->index('group', 'idx_group');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('system_settings');
    }
};
