12 lines
516 B
MySQL
12 lines
516 B
MySQL
|
|
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);
|