Skip to content
Williamsliam23 edited this page Nov 22, 2021 · 3 revisions

users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
email string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on username, unique: true
  • index on email, unique: true
  • index on session_token, unique: true

servers

column name data type details
id integer not null, primary key
creator_id integer not null, foreign key, indexed
title string not null
description string not null
created_at datetime not null
updated_at datetime not null
  • creator_id foreign key reference to user who created the server

channels

column name data type details
id integer not null, primary key
server_id integer not null, foreign key, indexed
title string not null
author_id string not null, foreign key, indexed
created_at datetime not null
updated_at datetime not null
  • server_id foreign key reference to server holding the channel
  • author_id foreign key reference to user who wrote the message

messages

column name data type details
id integer not null, primary key
channel_id integer not null, foreign key, indexed
author_id integer not null, foreign key, indexed
body string not null
created_at datetime not null
updated_at datetime not null
  • channel_id foreign key reference to the channel that holds the message
  • author_id foreign key reference to the user who created the message

joins

column name data type details
id integer not null, primary key
server_id integer not null, foreign key, indexed
user_id integer not null, foreign key, indexed
created_at datetime not null
updated_at datetime not null
Clone this wiki locally