Skip to content

Database Schema

greathmaster edited this page Feb 25, 2020 · 9 revisions

Database Schema

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

messages

column name data type details
id integer not null, primary key
content string not null
receiverable_id integer not null, indexed
receiverable_type string not null, indexed [users, channel]
owner_id integer not null, indexed
created_at datetime not null
updated_at datetime not null
  • polymorphic between channel table and users table.

Clone this wiki locally