conversations table

The conversations table in the Social Media Database Schema schema has 6 columns, keyed by id, with 1 foreign key to users. 3 columns in conversation_participants, messages and message_reads reference it.

last_message_at is denormalised so the inbox sorts without touching messages.

Columns (6)

Columns of the conversations table
ColumnTypeConstraintsDescription
iduuidprimary key
typeconversation_typenot null
titlevarchar(120)
created_byuuidnot null, references users.id
created_attimestamptznot null
last_message_attimestamptz

Indexes (1)

  • (last_message_at)

Relationships