Schema - connorryanbaker/slaq GitHub Wiki
Users Table
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
name | string | null: false |
string | null: false | |
password_digest | string | null: false |
session_token | string | null: false |
avatar_url | string | null:false |
timestamps | ||
*activated | boolean | tbd |
- basic user auth
- time permitting users will activate their accounts with email
Messages Table
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
content | string | null: false |
user_id | integer | null: false, foreign_key |
parent_message_id | integer | null: false, foreign_key |
messageable_id | integer | null: false, foreign_key |
messageable_type | string | null: false |
- all messages will be kept in the same table
- they will be pulled from the db when workspaces/channels/dms are loaded via .includes active record method
- parent_message_id will be a foreign key pointing to other messages as part of implementing threads
- messages will belong_to channels or dms - the messageable_id will be the foreign_key and the messageable_type will be the appropriate class name
Channels Table
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
name | string | null: false |
workspace_id | integer | null: false, foreign_key |
- every channel will belong to a workspace
DMs Table
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
name | string | null: false |
workspace_id | integer | null: false, foreign_key |
Workspaces Table
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
name | string | null: false |
admin_id | integer | null: false, foreign_key |
- every workspace will have a name and belong to an admin
Channel Users (Joins Table)
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
user_id | integer | null: false, foreign_key |
channelable_id | integer | null: false, foreign_key |
channelable_type | string | null: false |
index [:channel_id, :user_id], unique: true |
- users mapped to channels/dms through polymorphic association, the idea being channels and dms will have_many users through channel_users
Workspace Users (Joins Table)
col_name | data_type | details |
---|---|---|
id | integer | primary key, null: false |
user_id | integer | null: false, foreign_key |
workspace_id | integer | null: false, foreign_key |
index [:workspace_id, :user_id], unique: true |
- maps which users have access to which workspace