saved_items table
The saved_items table in the Reddit Clone Database Schema schema has 5 columns, with 1 foreign key to users.
A join table rather than a flag, so saving survives the post being removed and the saved tab can still show that something was there.
Columns (5)
| Column | Type | Constraints | Description |
|---|---|---|---|
| user_id | uuid | not null, references users.id | |
| content_type | content_type | not null | |
| content_id | uuid | not null | |
| category | varchar(50) | ||
| saved_at | timestamptz | not null |
Indexes (1)
(user_id, saved_at)
Relationships
saved_items.user_idreferencesusers.id