Skip to main content

max / multithreaded

405 B · 9 lines History Blame Raw
1 CREATE TABLE tracked_threads (
2 user_id UUID NOT NULL REFERENCES users(mnw_account_id) ON DELETE CASCADE,
3 thread_id UUID NOT NULL REFERENCES threads(id) ON DELETE CASCADE,
4 last_read_post_id UUID REFERENCES posts(id) ON DELETE SET NULL,
5 tracked_at TIMESTAMPTZ NOT NULL DEFAULT now(),
6 PRIMARY KEY (user_id, thread_id)
7 );
8 CREATE INDEX idx_tracked_threads_user ON tracked_threads(user_id);
9