<?php

/**
 * 文件功能：用户表增加 active_decorations JSON 列
 * 用于存储用户当前激活的个人装扮信息（气泡/昵称颜色/头像框）及过期时间。
 *
 * JSON 结构示例：
 * {
 *     "bubble":      {"style": "msg_bubble_golden",  "expires_at": "2026-05-04T12:00:00+08:00"},
 *     "name_color":  {"style": "msg_name_rainbow",   "expires_at": "2026-05-01T12:00:00+08:00"},
 *     "avatar_frame":{"style": "avatar_frame_dragon", "expires_at": "2026-05-27T12:00:00+08:00"}
 * }
 *
 * @author   ChatRoom Laravel
 *
 * @version  1.0.0
 */

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * 新增 active_decorations 列（可空 JSON）。
     */
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->json('active_decorations')->nullable()
                ->comment('用户当前激活的装扮：bubble 气泡 / name_color 昵称颜色 / avatar_frame 头像框，含过期时间');
        });
    }

    /**
     * 回滚：删除 active_decorations 列。
     */
    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('active_decorations');
        });
    }
};
