Skip to content

database schema

ziqi23 edited this page Apr 22, 2023 · 13 revisions

users

column name data type details
id bigint not null, primary key
username string not null, indexed, unique
email string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique

pages

column name data type details
id bigint not null, primary key
page_icon string not null
page_name string not null
journal_id bigint foreign key, indexed
html_content string not null
favorite boolean not null
belongs_to_team bigint foreign key, indexed
created_at string not null
updated_at string not null

Note: belongs_to_team may be empty if journal belongs to a user

teams

column name data type details
id bigint not null, primary key
team_name string not null

team users

column name data type details
id bigint not null, primary key
team_id bigint not null, foreign key, indexed
user_id bigint not null, foreign key, indexed

comments

column name data type details
id bigint not null, primary key
creater_id bigint not null, foreign key, indexed
body string not null

user comments

column name data type details
id bigint not null, primary key
comment_id bigint not null, foreign key, indexed
receiver_id bigint not null, foreign key, indexed
Clone this wiki locally