NAME NOT SET Documentation
Link to diagram: https://app.quickdatabasediagrams.com/#/d/y8OBmj
Server Database - Schema Version 2
Please bump the version by 1, any time the schema changes.
Also, include the migration plan under app/database/migration/server,
update all models, relationships and types.
Lastly, export all PNGs, SVGs, etc under the source project (./docs/database)
If you have any question/queries that you would like to clarify, please reach out to the Mobile Platform Team.
Category
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
collapsed		bool			
display_name		string			
muted		bool			
sort_order		number			
sorting	alpha, recent, manual	string			
team_id		string		FK, INDEX	
type	'channels' | 'direct_messages' | 'favorites' | 'custom'	string			
CategoryChannel
Field	Description	Type	Default	Other	
id	composition ID Team.id_Channel.id	string		PK	
category_id		string		FK, INDEX	
channel_id		string		FK, INDEX	
sort_order		number			
Channel
Field	Description	Type	Default	Other	
id	server-generated	string		PK, FK	
create_at		string			
creator_id		string		FK, INDEX	
delete_at		number			
display_name		string			
is_group_constrained		bool			
name		string		INDEX	
shared		bool			
team_id		string		FK, INDEX	
type		string			
update_at		number			
banner_info		string			
ChannelInfo
Field	Description	Type	Default	Other	
id	same value as Channel.id	string		PK, FK	
guest_count		number			
header		string			
member_count		number			
pinned_post_count		number			
files_count		number			
purpose		string			
ChannelMembership
Field	Description	Type	Default	Other	
id	composition ID Channel.id-User.id	string		PK	
channel_id		string		FK, INDEX	
user_id		string		FK, INDEX	
scheme_admin		bool			
CustomEmoji
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
name		string			
Draft
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
channel_id		string		FK, INDEX	
files	stringify (array)	string			
message		string			
root_id		string		FK, NULLABLE, INDEX	
update_at		number			
File
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
extension		string			
height		number			
image_thumbnail	base64 data string or filepath for video thumbnails	string			
local_path		string		NULLABLE	
mime_type		string			
name		string			
post_id		string		FK, INDEX	
size		number			
width		number			
Group
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
name		string		INDEX	
display_name		string			
description		string			
remote_id		string		INDEX	
source		string			
created_at		number			
updated_at		number			
deleted_at		number			
GroupChannel
Field	Description	Type	Default	Other	
id	composition ID Group.id-Channel.id	string		PK	
group_id		string		FK, INDEX	
channel_id		string		FK, INDEX	
created_at		number			
updated_at		number			
deleted_at		number			
GroupMembership
Field	Description	Type	Default	Other	
id	composition ID Group.id-User.id	string		PK	
group_id		string		FK, INDEX	
user_id		string		FK, INDEX	
created_at		number			
updated_at		number			
deleted_at		number			
GroupTeam
Field	Description	Type	Default	Other	
id	composition ID Group.id-Team.id	string		PK	
group_id		string		FK, INDEX	
team_id		string		FK, INDEX	
created_at		number			
updated_at		number			
deleted_at		number			
MyChannel
Field	Description	Type	Default	Other	
id	same as Channel.id	string		PK, FK	
is_unread		boolean			
last_post_at		number			
last_viewed_at		number			
manually_unread		boolean			
mentions_count		number			
message_count		number			
roles		string			
viewed_at		number			
MyChannelSettings
Field	Description	Type	Default	Other	
id	same as Channel.id	string		PK, FK	
notify_props		string			
MyTeam
Field	Description	Type	Default	Other	
id	same as Team.id	string		PK, FK	
roles		string			
Post
Field	Description	Type	Default	Other	
id	server generated	string		PK	
channel_id		string		FK, INDEX	
create_at		number			
delete_at		number			
edit_at		number			
is_pinned		boolean			
message		string			
metadata		string		NULLABLE	
original_id		string			
pending_post_id		string		INDEX	
previous_post_id		string			
props		string			
root_id		string			
type		string			
update_at		number			
user_id		string		FK, INDEX	
PostsInChannel
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
channel_id		string		FK, INDEX	
earliest		number			
latest		number			
PostsInThread
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
earliest		number			
latest		number			
root_id		string		FK	
Preference
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
category		string		INDEX	
name		string			
user_id		string		FK, INDEX	
value		string			
Reaction
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
create_at		number			
emoji_name		string			
post_id		string		FK, INDEX	
user_id		string		FK, INDEX	
Role
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
name		string			
permissions	stringify array	string			
System
Field	Description	Type	Default	Other	
id	SYSTEM_IDENTIFIERS	string		PK	
value		string			
Team
Field	Description	Type	Default	Other	
id	server-generated	string		PK	
allowed_domains		string			
description		string			
display_name		string			
is_allow_open_invite		boolean			
is_group_constrained		boolean			
last_team_icon_updated_at		number			
name		string			
type		string			
update_at		number			
TeamChannelHistory
Field	Description	Type	Default	Other	
id	same as Team.id	string		PK, FK	
channel_ids	stringified JSON array; FIFO	string			
TeamMembership
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
team_id		string		FK, INDEX	
user_id		string		FK, INDEX	
scheme_admin		bool			
TeamSearchHistory
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
created_at		number			
display_term		string			
team_id		string		FK	
term		string			
Thread
Field	Description	Type	Default	Other	
id	similar to Post.id but for root post only	string		PK, FK	
is_following		boolean			
last_reply_at		number			
last_viewed_at		number			
reply_count		number			
unread_mentions		number			
unread_replies		number			
viewed_at		number			
ThreadsInTeam
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
loaded_in_global_threads		boolean			
team_id		string		FK, INDEX	
thread_id		string		FK, INDEX	
ThreadParticipant
who is participating in this conversation
Field	Description	Type	Default	Other	
id	auto-generated	string		PK	
thread_id		string		FK, INDEX	
user_id		string		FK, INDEX	
User
Field	Description	Type	Default	Other	
id	server generated	string		PK	
auth_service		string			
delete_at		number			
email		string			
first_name		string			
is_bot		boolean			
is_guest		boolean			
last_name		string			
last_picture_update		number			
locale		string			
nickname		string			
notify_props		string			
position		string			
props		string			
remote_id		string		NULLABLE	
roles		string			
status		string			
timezone		string			
update_at		number			
username		string