chat_channels table

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

One table for direct chats, group chats, community channels and mod team rooms, distinguished by kind. They differ only in who may join, which is membership, not structure.

Columns (10)

Columns of the chat_channels table
ColumnTypeConstraintsDescription
iduuidprimary key
subreddit_iduuidreferences subreddits.id
kindchat_channel_kindnot null
namevarchar(100)
topicvarchar(500)
created_byuuidreferences users.id
is_privatebooleannot null
member_countintegernot null
last_message_attimestamptz
created_attimestamptznot null

Indexes (2)

  • (subreddit_id, kind)
  • (kind, last_message_at)

Relationships