collections table
The collections table in the Reddit Clone Database Schema schema has 8 columns, keyed by id, with 2 foreign keys to subreddits and users. 2 columns in posts and collection_posts reference it.
A moderator-curated series, which is how an event or an AMA week is presented as one thing. Posts keep their own identity and simply carry collection_id.
Columns (8)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | not null, references subreddits.id | |
| author_id | uuid | references users.id | |
| title | varchar(200) | not null | |
| description_md | varchar(1000) | ||
| layout | collection_layout | not null | |
| created_at | timestamptz | not null | |
| updated_at | timestamptz | not null |
Indexes (1)
(subreddit_id, updated_at)
Relationships
collections.subreddit_idreferencessubreddits.idcollections.author_idreferencesusers.idposts.collection_idreferencescollectionscollection_posts.collection_idreferencescollections