chat_messages table

The chat_messages table in the Reddit Clone Database Schema schema has 9 columns, keyed by id, with 4 foreign keys to chat_channels, users, chat_messages and media_assets. 2 columns in chat_channel_members and chat_reactions reference it.

Columns (9)

Columns of the chat_messages table
ColumnTypeConstraintsDescription
iduuidprimary key
channel_iduuidnot null, references chat_channels.id
author_iduuidreferences users.id
reply_to_iduuidreferences chat_messages.id
bodytextnot null
media_asset_iduuidreferences media_assets.id
created_attimestamptznot null
edited_attimestamptz
deleted_attimestamptz

Indexes (2)

  • (channel_id, created_at)
  • (author_id, created_at)

Relationships