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)

Columns of the collections table
ColumnTypeConstraintsDescription
iduuidprimary key
subreddit_iduuidnot null, references subreddits.id
author_iduuidreferences users.id
titlevarchar(200)not null
description_mdvarchar(1000)
layoutcollection_layoutnot null
created_attimestamptznot null
updated_attimestamptznot null

Indexes (1)

  • (subreddit_id, updated_at)

Relationships