topic_subscriptions table
The topic_subscriptions table in the Forum Database Schema schema has 5 columns, with 3 foreign keys to users, topics and posts.
last_read_post_id is a high-water mark, not a row per post read. Unread count is a range query above it.
Columns (5)
Columns of the topic_subscriptions table| Column | Type | Constraints | Description |
|---|
| user_id | uuid | not null, references users.id | |
|---|
| topic_id | uuid | not null, references topics.id | |
|---|
| level | subscription_level | not null | |
|---|
| last_read_post_id | uuid | references posts.id | |
|---|
| subscribed_at | timestamptz | not null | |
|---|
Relationships
topic_subscriptions.user_id references users.idtopic_subscriptions.topic_id references topics.idtopic_subscriptions.last_read_post_id references posts.id