stories table
The stories table in the Social Media Database Schema schema has 7 columns, keyed by id, with 1 foreign key to users. 1 column in story_views references it.
expires_at is written at creation, not inferred. The index on it is what lets a sweeper reap expired rows cheaply.
Columns (7)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| author_id | uuid | not null, references users.id | |
| media_url | varchar(500) | not null | |
| type | media_type | not null | |
| caption | varchar(500) | ||
| created_at | timestamptz | not null | |
| expires_at | timestamptz | not null |
Indexes (2)
(author_id, expires_at)(expires_at)
Relationships
stories.author_idreferencesusers.idstory_views.story_idreferencesstories