Schema - nohani/Thought-Bubble GitHub Wiki
Users
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
username | string | not null, unique, indexed |
string | not null, unique, indexed | |
password_digest | string | not null |
session_token | string | not null, unique, indexed |
created_at | datetime | not null |
updated_at | datetime |
username
indexed, unique: trueemail
indexed, unique: truesession_token
indexed, unique: true
Posts
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
author_id | integer | not null, foreign_key |
type | string | not null, inclusion |
content | text | not null |
created_at | datetime | not null |
updated_at | datetime |
user_id
references theUsers
tabletype
includes: text, photo, quote, link, chat, audio, video
Follows
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
follower_id | integer | not null, foreign key |
followee_id | integer | not null, foreign key |
created_at | datetime | not null |
updated_at | datetime |
follower_id
references theUsers
tablefollowee_id
references theUsers
table
Likes
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
post_id | integer | not null, foreign key |
liker_id | integer | not null, foreign key |
created_at | datetime | not null |
updated_at | datetime |
post_id
references thePosts
tableliker_id
references theUsers
table- add index on [
post_id
,liker_id
] columns