-- 修复eb_live_room表的like_count字段
-- 1. 将NULL值更新为0
UPDATE eb_live_room SET like_count = 0 WHERE like_count IS NULL;

-- 2. 修改字段定义，添加默认值和NOT NULL约束
ALTER TABLE eb_live_room 
MODIFY COLUMN like_count INT NOT NULL DEFAULT 0 COMMENT '点赞数';

-- 3. 同样修复其他计数字段
UPDATE eb_live_room SET comment_count = 0 WHERE comment_count IS NULL;
UPDATE eb_live_room SET online_count = 0 WHERE online_count IS NULL;
UPDATE eb_live_room SET view_count = 0 WHERE view_count IS NULL;
UPDATE eb_live_room SET share_count = 0 WHERE share_count IS NULL;

ALTER TABLE eb_live_room 
MODIFY COLUMN comment_count INT NOT NULL DEFAULT 0 COMMENT '评论数',
MODIFY COLUMN online_count INT NOT NULL DEFAULT 0 COMMENT '在线人数',
MODIFY COLUMN view_count INT NOT NULL DEFAULT 0 COMMENT '观看人数',
MODIFY COLUMN share_count INT NOT NULL DEFAULT 0 COMMENT '分享数';

-- 4. 验证修复结果
SELECT id, title, like_count, comment_count, online_count, view_count, share_count 
FROM eb_live_room 
WHERE id = 8;
