spark-server/migrations/0026_square_bot_rss.sql
DESKTOP-L8OUL9F\gfl0034 715ace7ac6 feat(square): 广场 Bot/RSS 发布与媒体校验
支持广场机器人发帖与媒体类型检查,并补充相关迁移与 i18n。
2026-09-24 23:07:06 +08:00

20 lines
1.0 KiB
SQL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 广场机器人海外媒体 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 去重';