8000 Schema · kliu33/Kcals Wiki · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Kevin Liu edited this page Feb 7, 2023 · 11 revisions

users

column name data type details
id big int not null, primary key
username string not null, indexed, unique
email string not null, indexed, unique
first_name string not null, indexed, unique
last_name 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

  • has_many channels

  • has_many messages

  • has_many reactions

  • belongs_to channels

channels

column name data type details
id big int not null, primary key
name string not null, indexed, unique
creator_id integer not null, indexed, foreign key
created at datetime not null
updated at datetime not null
  • creator_id references user

  • belongs_to creator

  • has_many users

  • has_many messages

  • index on name and creator_id

messages

column name data type details
id big int not null, primary key
body text not null
author_id integer not null, indexed, foreign key
channel_id integer not null, indexed, foreign key
created at datetime not null
updated at datetime not null
  • belongs_to user

  • belongs_to channel

  • has many reactions

  • author_id and channel_id references user and channel

reactions

column name data type details
id big int not null, primary key
message_id integer not null, indexed, foreign key
author_id integer not null, indexed, foreign key
created at datetime not null
updated at datetime not null
  • belongs to user

  • belongs to message

Clone this wiki locally
0