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)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| subreddit_id | uuid | not null, references subreddits.id | |
| kind | widget_kind | not null | |
| title | varchar(100) | ||
| config_json | text | not null | |
| position | smallint | not null | |
| is_enabled | boolean | not null |
Indexes (1)
(subreddit_id, position)
Relationships
subreddit_widgets.subreddit_idreferencessubreddits.id