spark-server/migrations/0008_favorites.sql
zhr ae9a71034d feat: implement Spark IM V3 modular monolith
Add HTTP /v1 MVC, TCP send path, groups with server-side member-avatar collage, object-storage upload, and friends/favorites around the architecture-v3 layout.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 19:52:11 +08:00

14 lines
937 B
SQL
Raw 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.

-- 用户收藏。媒体对象复制到 perm/fav,不引用 chat/ 原 key;源对象过期则无法再收藏。
CREATE TABLE IF NOT EXISTS favorites (
id BIGINT PRIMARY KEY COMMENT 'Snowflake 收藏 id',
user_id BIGINT NOT NULL COMMENT '收藏者 user_id',
msg_id BIGINT NOT NULL COMMENT '原消息 Snowflake id,仅作来源;撤回不影响收藏',
conversation_id BIGINT NOT NULL COMMENT '原会话 id,仅作来源',
message_type SMALLINT NOT NULL COMMENT '消息类型,与 messages.message_type 一致',
content BLOB NOT NULL COMMENT '收藏快照(JSON 字节);媒体 key 已复制到 perm/fav/',
created_at DATETIME(3) NOT NULL COMMENT '收藏时间',
UNIQUE KEY uk_user_msg (user_id, msg_id),
KEY idx_user_id (user_id, id)
) COMMENT='用户收藏。媒体复制到 perm/fav;chat/ 源过期后收藏失败,不提供补传';