CREATE TABLE IF NOT EXISTS portal_update_receipts (
  id TEXT PRIMARY KEY,
  release_id TEXT NOT NULL,
  user_id TEXT NOT NULL,
  status TEXT NOT NULL DEFAULT 'SEEN',
  seen_at INTEGER NOT NULL,
  applied_at INTEGER,
  updated_at INTEGER NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_update_receipts_release_user ON portal_update_receipts(release_id,user_id);
CREATE INDEX IF NOT EXISTS idx_update_receipts_user_status ON portal_update_receipts(user_id,status,updated_at);
