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)

Columns of the stories table
ColumnTypeConstraintsDescription
iduuidprimary key
author_iduuidnot null, references users.id
media_urlvarchar(500)not null
typemedia_typenot null
captionvarchar(500)
created_attimestamptznot null
expires_attimestamptznot null

Indexes (2)

  • (author_id, expires_at)
  • (expires_at)

Relationships