feat(server/migrate): 000026 notices 表 + users.notices_read_at 已读水位

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P9G7E3wmAYL9KeYCVZVsqu
This commit is contained in:
wangjia
2026-07-13 13:32:23 +08:00
parent 0657a830d0
commit 21a30aa4c8
6 changed files with 51 additions and 8 deletions
@@ -0,0 +1,2 @@
DROP TABLE notices;
ALTER TABLE users DROP COLUMN notices_read_at;
@@ -0,0 +1,18 @@
ALTER TABLE users ADD COLUMN notices_read_at DATETIME;
CREATE TABLE notices (
id INTEGER PRIMARY KEY AUTOINCREMENT,
type TEXT NOT NULL CHECK (type IN ('important','feature','news','reward','version','promo')),
user_id INTEGER, -- NULL=全员广播;非空=定向该用户
title_zh TEXT NOT NULL,
title_en TEXT NOT NULL,
body_zh TEXT,
body_en TEXT,
link TEXT,
published_at DATETIME NOT NULL,
expires_at DATETIME,
revoked_at DATETIME,
email_sent_at DATETIME,
FOREIGN KEY (user_id) REFERENCES users(id)
);
CREATE INDEX ix_notices_user_pub ON notices(user_id, published_at);