spark-server/migrations/0031_square_channel_category.sql
DESKTOP-L8OUL9F\gfl0034 53426af122 feat: 多广场 channel、音乐公开 API 与订阅 package_name
支持 square/squarenovel/squaresteps/squarehealth 实例与 category 筛选;音乐增加免登录 grouped/track;订阅套餐按 package_name 区分;补 migration 0030/0031 与 OpenAPI。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-30 09:02:28 +08:00

25 lines
1.1 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.

-- 多广场实例(channel)+ 分类筛选(category)。旧帖默认 channel=square、category 空。
ALTER TABLE t_square_posts
ADD COLUMN channel VARCHAR(32) NOT NULL DEFAULT 'square' COMMENT '广场实例:square/squarenovel/squaresteps/squarehealth' AFTER user_id,
ADD COLUMN category VARCHAR(32) NOT NULL DEFAULT '' COMMENT '内容标签:funny/beauty 等;空为未分类' AFTER channel;
ALTER TABLE t_square_posts
ADD KEY idx_channel_public_feed (channel, audit_status, visibility, id),
ADD KEY idx_channel_hot (channel, audit_status, visibility, like_count, id),
ADD KEY idx_channel_category (channel, category, id),
ADD KEY idx_channel_user (channel, user_id, id);
ALTER TABLE t_square_notices
ADD COLUMN channel VARCHAR(32) NOT NULL DEFAULT 'square' COMMENT '广场实例,与帖一致' AFTER to_user_id;
ALTER TABLE t_square_notices
ADD KEY idx_channel_to_user (channel, to_user_id, id);
ALTER TABLE t_square_notice_state
ADD COLUMN channel VARCHAR(32) NOT NULL DEFAULT 'square' COMMENT '广场实例' AFTER user_id;
ALTER TABLE t_square_notice_state
DROP PRIMARY KEY,
ADD PRIMARY KEY (user_id, channel);