spark-server/migrations/0010_message_deletes.sql
2026-09-23 17:11:56 +08:00

11 lines
668 B
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.

-- Per-user delete (hide). Does not change t_messages.status or the peer's history.
CREATE TABLE IF NOT EXISTS t_message_deletes (
user_id BIGINT NOT NULL COMMENT '删除者 user_id,仅该用户历史不可见',
msg_id BIGINT NOT NULL COMMENT '被删除的 Snowflake MsgId',
conversation_id BIGINT NOT NULL COMMENT '所属会话,便于按会话过滤',
created_at DATETIME(3) NOT NULL COMMENT '删除时间',
PRIMARY KEY (user_id, msg_id),
KEY idx_user_conv_msg (user_id, conversation_id, msg_id)
) COMMENT='用户删除消息(只对自己隐藏)。对端仍可见;全员撤回走 t_messages.status=2';