Schema - absterr08/slap GitHub Wiki

users

Column Name Data Type Details
id integer not null, primary key
username string not null, unique, indexed
image_url string not null
password_digest string not null
session_token string not null, unique, indexed
created_at datetime not null
updated_at datetime not null
  • has_many :messages
  • has_many :channels
  • has_many :dms

channels

Column Name Data Type Details
id integer not null, primary key
name string not null, unique, indexed
description string
is_private boolean
created_at datetime not null
updated_at datetime not null
  • has_many :messages
  • has_many :users

channel_subscriptions

Column Name Data Type Details
id integer not null, primary key
user_id string not null, indexed, foreign_key
channel_id string not null, indexed, foreign_key
created_at datetime not null
updated_at datetime not null
  • belongs_to :user
  • belongs_to :channel

dms

Column Name Data Type Details
id integer not null, primary key
name string not null, unique, indexed
identifier string not null, unique, indexed
created_at datetime not null
updated_at datetime not null
  • has_many :messages
  • has_many :users

dm_subscriptions

Column Name Data Type Details
id integer not null, primary key
user_id string not null, indexed, foreign_key
dm_id string not null, indexed, foreign_key
active boolean
created_at datetime not null
updated_at datetime not null

messages

Column Name Data Type Details
id integer not null, primary key
author_id integer not null, indexed, foreign_key
messageable_id integer not null, indexed, foreign_key
parent_message_id integer indexed, foreign_key
body string not null
created_at datetime not null
updated_at datetime not null
  • belongs_to :user
  • belongs_to :channel or :dm