subreddit_widgets table

The subreddit_widgets table in the Reddit Clone Database Schema schema has 7 columns, keyed by id, with 1 foreign key to subreddits.

Sidebar widgets are rows with a JSON body rather than a table per widget type. The shape varies per kind and is validated in application code, which is the honest trade when the catalog of kinds changes faster than migrations ship.

Columns (7)

Columns of the subreddit_widgets table
ColumnTypeConstraintsDescription
iduuidprimary key
subreddit_iduuidnot null, references subreddits.id
kindwidget_kindnot null
titlevarchar(100)
config_jsontextnot null
positionsmallintnot null
is_enabledbooleannot null

Indexes (1)

  • (subreddit_id, position)

Relationships