Files
pangolin/server/migrations/sqlite/000026_notices.up.sql
T

19 lines
617 B
SQL

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);