USE zhibo;

-- 1. 检查表是否存在
SELECT 'eb_follow_record表存在' as status;

-- 2. 查看表结构中的所有字段
SELECT COLUMN_NAME, COLUMN_TYPE, IS_NULLABLE, COLUMN_DEFAULT
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'zhibo' 
  AND TABLE_NAME = 'eb_follow_record'
ORDER BY ORDINAL_POSITION;

-- 3. 查看总记录数
SELECT COUNT(*) as total_records FROM eb_follow_record;

-- 4. 查看最新的记录
SELECT * FROM eb_follow_record ORDER BY id DESC LIMIT 3;

-- 5. 检查唯一键约束
SELECT CONSTRAINT_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
WHERE TABLE_SCHEMA = 'zhibo'
  AND TABLE_NAME = 'eb_follow_record'
  AND CONSTRAINT_NAME LIKE '%unique%' OR CONSTRAINT_NAME LIKE '%uk%';

-- 6. 查看当前登录的用户（假设是120）
SELECT uid, nickname, phone FROM eb_user WHERE uid = 120;

-- 7. 查看可关注的主播
SELECT uid, nickname, phone, is_streamer 
FROM eb_user 
WHERE is_streamer = 1 
LIMIT 5;
