-- 广场机器人海外媒体 RSS:帖来源、原文 URL、过期时间与 URL 去重。 ALTER TABLE t_square_posts ADD COLUMN source SMALLINT NOT NULL DEFAULT 0 COMMENT '0用户 1机器人海外媒体RSS' AFTER status, ADD COLUMN source_url VARCHAR(768) NOT NULL DEFAULT '' COMMENT '原文 URL,机器人帖去重键' AFTER source, ADD COLUMN expires_at DATETIME(3) NULL COMMENT '机器人帖过期时间;到期不可见并清理' AFTER source_url; ALTER TABLE t_square_posts ADD KEY idx_square_posts_expires (expires_at, status), ADD KEY idx_square_posts_source_url (source_url); CREATE TABLE IF NOT EXISTS t_square_bot_links ( url_hash CHAR(64) NOT NULL COMMENT '规范化 URL 的 SHA-256 hex', url VARCHAR(768) NOT NULL COMMENT '原文 URL', post_id BIGINT NOT NULL COMMENT '关联 t_square_posts.id', created_at DATETIME(3) NOT NULL COMMENT '入库时间', PRIMARY KEY (url_hash), KEY idx_square_bot_links_post (post_id) ) COMMENT='广场机器人 RSS 原文 URL 去重';