-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Ruiyu Wu edited this page Aug 28, 2019
·
29 revisions
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
string | not null | |
password_digest | string | not null |
session_token | string | not null, indexed, unique |
first_name | string | not null |
last_name | string | not null |
gender | string | not null |
location | string | |
workplace | string | |
education | string | |
current_city | string | |
hometown | string | |
bio | text | |
birth_date | datetime | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- add_index to
email
,unique: true
- add_index to
session_token
,unique: true
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
body | text | |
author_id | integer | not null, indexed |
user_id | integer | not null, indexed |
created_at | datetime | not null |
updated_at | datetime | not null |
- add_index to
author_id
- add_index to
user_id
-
author_id
refers tousers
(who authored this post) -
user_id
refers tousers
(to whom the post belongs) - posts will just be validated on the front-end for whether or not it needs a body (depending on if it has a picture)
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
body | text | |
author_id | integer | not null, indexed |
post_id | integer | not null, indexed |
parent_comment_id | integer | optional, indexed |
created_at | datetime | not null |
updated_at | datetime | not null |
- add_index to
author_id
- add_index to
post_id
- add_index to
parent_comment_id
-
author_id
refers tousers
-
post_id
refers toposts
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
requester_id | integer | not null, indexed |
requested_friend_id | integer | not null, indexed |
status | string | not null, default: "pending" |
created_at | datetime | not null |
updated_at | datetime | not null |
- add_index to
requester_id
- add_index to
requested_friend_id
- add_index to
[requester_id, requested_friend_id], unique: true
-
requester_id
refers tousers
-
requested_friend_id
refers tousers
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
user_id | integer | not null, indexed |
likeable_id | integer | not null, indexed |
likeable_type | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
- add_index to
user_id
- add_index to
likeable_id
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
post_id | integer | not null, indexed |
user_id | integer | not null, indexed |
created_at | datetime | not null |
updated_at | datetime | not null |
- add_index to
user_id
- add_index to
post_id
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
name | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
name | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |
column name | data type | details |
---|---|---|
id | integer | not null, primary key |
name | string | not null |
created_at | datetime | not null |
updated_at | datetime | not null |