-- One directed follow per pair. Mutual follows become friend edges in logic; unfollowing does not delete messages. CREATE TABLE IF NOT EXISTS t_user_follows ( id BIGINT NOT NULL AUTO_INCREMENT COMMENT '行 id,表内自增', user_id BIGINT NOT NULL COMMENT '关注人 user_id', target_id BIGINT NOT NULL COMMENT '被关注人 user_id', created_at DATETIME(3) NOT NULL COMMENT '关注时间', PRIMARY KEY (id), UNIQUE KEY uk_user_target (user_id, target_id), KEY idx_target (target_id) ) COMMENT='单向关注。双方互相关注时写入已有双向好友边;取消关注只删关注,不再互关时删好友边,不删消息';