backend/generate/database/cassandra/2025111700000002_user_notif...

12 lines
516 B
MySQL
Raw Permalink Normal View History

2025-11-17 09:31:58 +00:00
CREATE TABLE IF NOT EXISTS user_notification (
user_id text, -- 收通知的人
bucket text, -- 分桶,例如 '2025-11' 或 '2025-11-17'
ts timeuuid, -- 通知時間,用 now() 產生,排序用
event_id uuid, -- 對應 notification_event.event_id
status text, -- 'UNREAD' / 'READ' / 'ARCHIVED'
read_at timestamp, -- 已讀時間(非必填)
PRIMARY KEY ((user_id, bucket), ts)
) WITH CLUSTERING ORDER BY (ts DESC);