media table

The media table in the Blog Database Schema schema has 12 columns, keyed by id, with 1 foreign key to users. 2 columns in posts and post_media reference it.

A reusable library, not a per-post attachment list. alt_text is not optional in practice: it is both accessibility and image SEO.

Columns (12)

Columns of the media table
ColumnTypeConstraintsDescription
iduuidprimary key
uploaded_byuuidreferences users.id
typemedia_typenot null
urlvarchar(500)not null
thumbnail_urlvarchar(500)
alt_textvarchar(500)
captionvarchar(500)
mime_typevarchar(120)
widthinteger
heightinteger
size_bytesbigint
created_attimestamptznot null

Indexes (1)

  • (uploaded_by, created_at)

Relationships