ALTER TABLE users ADD COLUMN notices_read_at DATETIME(6) NULL;

CREATE TABLE notices (
  id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  type ENUM('important','feature','news','reward','version','promo') NOT NULL,
  user_id BIGINT UNSIGNED NULL,
  title_zh TEXT NOT NULL,
  title_en TEXT NOT NULL,
  body_zh TEXT NULL,
  body_en TEXT NULL,
  link TEXT NULL,
  published_at DATETIME(6) NOT NULL,
  expires_at DATETIME(6) NULL,
  revoked_at DATETIME(6) NULL,
  email_sent_at DATETIME(6) NULL,
  INDEX ix_notices_user_pub (user_id, published_at),
  FOREIGN KEY (user_id) REFERENCES users(id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
