-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Kevin Liu edited this page Feb 7, 2023
·
11 revisions
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
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
referencesuser
-
belongs_to creator
-
has_many users
-
has_many messages
-
index on
name
andcreator_id
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
andchannel_id
referencesuser
andchannel
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