ALTER TABLE `voice_room_rocket_config`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭系统配置',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
  MODIFY COLUMN `timezone` VARCHAR(64) NOT NULL DEFAULT 'Asia/Riyadh' COMMENT '业务时区',
  MODIFY COLUMN `max_level` INT NOT NULL DEFAULT 6 COMMENT '最大等级',
  MODIFY COLUMN `ranking_top_limit` INT NOT NULL DEFAULT 100 COMMENT '火箭王榜单展示人数',
  MODIFY COLUMN `reward_record_keep_days` INT NOT NULL DEFAULT 35 COMMENT '用户奖励记录展示天数',
  MODIFY COLUMN `broadcast_duration_seconds` INT NOT NULL DEFAULT 7 COMMENT '发射广播展示秒数',
  MODIFY COLUMN `in_room_reward_delay_seconds` INT NOT NULL DEFAULT 10 COMMENT '在房间奖励延迟窗口秒数',
  MODIFY COLUMN `energy_rule_json` JSON DEFAULT NULL COMMENT '礼物折算规则',
  MODIFY COLUMN `rule_text` JSON DEFAULT NULL COMMENT '规则说明多语言文案',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_level_config`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭等级配置',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '火箭等级，Lv.1-Lv.6',
  MODIFY COLUMN `need_energy` BIGINT NOT NULL COMMENT '本级发射所需能量',
  MODIFY COLUMN `shake_threshold_percent` DECIMAL(8,4) NOT NULL DEFAULT 0 COMMENT '抖动阈值百分比',
  MODIFY COLUMN `preview_rocket_url` VARCHAR(512) DEFAULT NULL COMMENT '预览火箭资源URL',
  MODIFY COLUMN `rocket_icon_url` VARCHAR(512) DEFAULT NULL COMMENT '火箭图标资源URL',
  MODIFY COLUMN `rocket_animation_url` VARCHAR(512) DEFAULT NULL COMMENT '火箭发射动画资源URL',
  MODIFY COLUMN `progress_bar_url` VARCHAR(512) DEFAULT NULL COMMENT '进度条资源URL（历史字段）',
  MODIFY COLUMN `enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
  MODIFY COLUMN `sort` INT NOT NULL DEFAULT 0 COMMENT '排序值，升序',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_reward_config`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭奖励配置',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '适用等级',
  MODIFY COLUMN `reward_scene` VARCHAR(32) NOT NULL COMMENT '奖励场景，TOP1/IGNITE/IN_ROOM',
  MODIFY COLUMN `reward_type` VARCHAR(32) NOT NULL COMMENT '奖励类型，GOLD/MOUNT/AVATAR_FRAME/CHAT_BUBBLE/VIP_CARD/GIFT/BADGE/NONE',
  MODIFY COLUMN `reward_item_id` BIGINT DEFAULT NULL COMMENT '道具、礼物、权益等资源ID',
  MODIFY COLUMN `reward_name` VARCHAR(128) NOT NULL COMMENT '奖励名称',
  MODIFY COLUMN `reward_cover` VARCHAR(512) DEFAULT NULL COMMENT '奖励封面URL',
  MODIFY COLUMN `reward_amount` BIGINT NOT NULL DEFAULT 1 COMMENT '金币数量或道具数量/天数',
  MODIFY COLUMN `expire_days` INT DEFAULT NULL COMMENT '时效类奖励有效天数',
  MODIFY COLUMN `reward_copies` INT NOT NULL DEFAULT 1 COMMENT 'IN_ROOM 本奖励每次发射可发放份数',
  MODIFY COLUMN `weight` INT NOT NULL DEFAULT 0 COMMENT 'IN_ROOM 随机抽取权重，小于等于0按1处理',
  MODIFY COLUMN `sort` INT NOT NULL DEFAULT 0 COMMENT '排序值，升序',
  MODIFY COLUMN `enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_status`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭当前状态',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `day_key` VARCHAR(16) NOT NULL COMMENT 'UTC+3 业务日 yyyyMMdd',
  MODIFY COLUMN `round_no` INT NOT NULL DEFAULT 1 COMMENT '当天第几轮火箭',
  MODIFY COLUMN `current_level` INT NOT NULL DEFAULT 1 COMMENT '当前等级',
  MODIFY COLUMN `current_energy` BIGINT NOT NULL DEFAULT 0 COMMENT '当前等级已累计能量',
  MODIFY COLUMN `need_energy` BIGINT NOT NULL COMMENT '当前等级所需能量',
  MODIFY COLUMN `status` VARCHAR(32) NOT NULL COMMENT '状态，CHARGING/LAUNCHING',
  MODIFY COLUMN `level_start_time` DATETIME NOT NULL COMMENT '当前等级开始时间',
  MODIFY COLUMN `last_event_time` DATETIME DEFAULT NULL COMMENT '最近一次有效送礼事件时间',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_level_round`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭每轮每级快照',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `day_key` VARCHAR(16) NOT NULL COMMENT 'UTC+3 业务日 yyyyMMdd',
  MODIFY COLUMN `round_no` INT NOT NULL COMMENT '当天第几轮火箭',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '火箭等级',
  MODIFY COLUMN `need_energy` BIGINT NOT NULL COMMENT '本级所需能量',
  MODIFY COLUMN `final_energy` BIGINT NOT NULL DEFAULT 0 COMMENT '本级最终累计能量',
  MODIFY COLUMN `status` VARCHAR(32) NOT NULL COMMENT '状态，CHARGING/LAUNCHED',
  MODIFY COLUMN `top1_user_id` BIGINT DEFAULT NULL COMMENT '本级贡献第一用户ID',
  MODIFY COLUMN `ignite_user_id` BIGINT DEFAULT NULL COMMENT '点火用户ID',
  MODIFY COLUMN `reach_time` DATETIME DEFAULT NULL COMMENT '能量达标时间',
  MODIFY COLUMN `launch_time` DATETIME DEFAULT NULL COMMENT '发射时间',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_contribution`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭贡献榜',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `day_key` VARCHAR(16) NOT NULL COMMENT 'UTC+3 业务日 yyyyMMdd',
  MODIFY COLUMN `round_no` INT NOT NULL COMMENT '当天第几轮火箭',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '火箭等级',
  MODIFY COLUMN `user_id` BIGINT NOT NULL COMMENT '贡献用户ID',
  MODIFY COLUMN `score_energy` BIGINT NOT NULL DEFAULT 0 COMMENT '计入榜单的能量值',
  MODIFY COLUMN `gift_count` INT NOT NULL DEFAULT 0 COMMENT '计入火箭的送礼次数',
  MODIFY COLUMN `first_contribute_time` DATETIME NOT NULL COMMENT '首次贡献时间',
  MODIFY COLUMN `last_contribute_time` DATETIME NOT NULL COMMENT '最近贡献时间',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_gift_event_log`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭送礼事件日志',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `track_id` VARCHAR(128) NOT NULL COMMENT '送礼事件唯一追踪ID',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `send_user_id` BIGINT NOT NULL COMMENT '送礼用户ID',
  MODIFY COLUMN `gift_id` BIGINT DEFAULT NULL COMMENT '礼物ID',
  MODIFY COLUMN `gift_type` VARCHAR(32) DEFAULT NULL COMMENT '礼物类型',
  MODIFY COLUMN `gift_tab` VARCHAR(64) DEFAULT NULL COMMENT '礼物分类',
  MODIFY COLUMN `raw_energy` BIGINT NOT NULL DEFAULT 0 COMMENT '原始能量值',
  MODIFY COLUMN `accepted_energy` BIGINT NOT NULL DEFAULT 0 COMMENT '实际计入火箭能量值',
  MODIFY COLUMN `day_key` VARCHAR(16) NOT NULL COMMENT 'UTC+3 业务日 yyyyMMdd',
  MODIFY COLUMN `round_no` INT NOT NULL COMMENT '当天第几轮火箭',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '火箭等级',
  MODIFY COLUMN `status` VARCHAR(32) NOT NULL COMMENT '处理状态，IGNORED/SUCCESS/FAILED',
  MODIFY COLUMN `raw_payload` MEDIUMTEXT COMMENT '原始消息内容',
  MODIFY COLUMN `error_message` VARCHAR(1024) DEFAULT NULL COMMENT '失败原因',
  MODIFY COLUMN `event_time` DATETIME NOT NULL COMMENT '事件发生时间',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_launch`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭发射记录',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `launch_no` VARCHAR(64) NOT NULL COMMENT '发射编号',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `room_account` VARCHAR(64) DEFAULT NULL COMMENT '房间号',
  MODIFY COLUMN `day_key` VARCHAR(16) NOT NULL COMMENT 'UTC+3 业务日 yyyyMMdd',
  MODIFY COLUMN `round_no` INT NOT NULL COMMENT '当天第几轮火箭',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '火箭等级',
  MODIFY COLUMN `final_energy` BIGINT NOT NULL COMMENT '发射时最终能量',
  MODIFY COLUMN `top1_user_id` BIGINT DEFAULT NULL COMMENT '贡献第一用户ID',
  MODIFY COLUMN `ignite_user_id` BIGINT DEFAULT NULL COMMENT '点火用户ID',
  MODIFY COLUMN `in_room_snapshot_status` VARCHAR(32) NOT NULL DEFAULT 'PENDING' COMMENT '在房用户快照状态，PENDING/SUCCESS/FAILED',
  MODIFY COLUMN `launch_time` DATETIME NOT NULL COMMENT '发射时间',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_reward_record`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭奖励记录',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `launch_id` BIGINT NOT NULL COMMENT '发射记录ID',
  MODIFY COLUMN `launch_no` VARCHAR(64) NOT NULL COMMENT '发射编号',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `day_key` VARCHAR(16) NOT NULL COMMENT 'UTC+3 业务日 yyyyMMdd',
  MODIFY COLUMN `round_no` INT NOT NULL COMMENT '当天第几轮火箭',
  MODIFY COLUMN `level` INT NOT NULL COMMENT '火箭等级',
  MODIFY COLUMN `user_id` BIGINT NOT NULL COMMENT '获奖用户ID',
  MODIFY COLUMN `reward_scene` VARCHAR(32) NOT NULL COMMENT '奖励场景，TOP1/IGNITE/IN_ROOM',
  MODIFY COLUMN `reward_config_id` BIGINT NOT NULL COMMENT '奖励配置ID',
  MODIFY COLUMN `reward_type` VARCHAR(32) NOT NULL COMMENT '奖励类型，GOLD/MOUNT/AVATAR_FRAME/CHAT_BUBBLE/VIP_CARD/GIFT/BADGE/NONE',
  MODIFY COLUMN `reward_item_id` BIGINT DEFAULT NULL COMMENT '奖励资源ID',
  MODIFY COLUMN `reward_name` VARCHAR(128) NOT NULL COMMENT '奖励名称',
  MODIFY COLUMN `reward_cover` VARCHAR(512) DEFAULT NULL COMMENT '奖励封面URL',
  MODIFY COLUMN `reward_amount` BIGINT NOT NULL DEFAULT 1 COMMENT '金币数量或道具数量/天数',
  MODIFY COLUMN `expire_days` INT DEFAULT NULL COMMENT '时效类奖励有效天数',
  MODIFY COLUMN `grant_event_id` VARCHAR(128) NOT NULL COMMENT '发奖幂等事件ID',
  MODIFY COLUMN `grant_status` VARCHAR(32) NOT NULL COMMENT '发奖状态，PENDING/SUCCESS/FAILED',
  MODIFY COLUMN `popup_status` VARCHAR(32) NOT NULL DEFAULT 'UNREAD' COMMENT '弹窗状态，UNREAD/READ',
  MODIFY COLUMN `error_message` VARCHAR(1024) DEFAULT NULL COMMENT '发奖失败原因',
  MODIFY COLUMN `grant_time` DATETIME DEFAULT NULL COMMENT '发奖完成时间',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  MODIFY COLUMN `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间';

ALTER TABLE `voice_room_rocket_audience_snapshot`
  DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = '语音房火箭在房用户快照',
  MODIFY COLUMN `id` BIGINT NOT NULL COMMENT '主键ID',
  MODIFY COLUMN `launch_id` BIGINT NOT NULL COMMENT '发射记录ID',
  MODIFY COLUMN `sys_origin` VARCHAR(32) NOT NULL COMMENT '系统来源',
  MODIFY COLUMN `room_id` BIGINT NOT NULL COMMENT '房间ID',
  MODIFY COLUMN `user_id` BIGINT NOT NULL COMMENT '在房用户ID',
  MODIFY COLUMN `last_seen_time` DATETIME NOT NULL COMMENT '最近在线时间',
  MODIFY COLUMN `selected` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否被抽中发放在房奖励',
  MODIFY COLUMN `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间';
