| Column Name |
Data Type |
Details |
| id |
integer |
not null, primary key |
| email |
string |
indexed, not null, unique |
| first_name |
string |
not null, indexed |
| last_name |
string |
not null, indexed |
| password_digest |
string |
not null |
| session_token |
string |
not null, indexed, unique |
| birth_date |
date |
not null |
| gender |
string |
not null, inclusion in "MALE, FEMALE" |
| bio |
text |
optional |
| location |
string |
optional |
| profile_img_url |
string |
optional |
| cover_img_url |
string |
optional |
Statuses will be posts where receiver id is the same as the author id. This makes it so that the user profile page posts will be easier to be queried for through association USER has_many received_posts. Still going through the pros and cons of having posts and comments under the same table.
| Column Name |
Data Type |
Details |
| id |
integer |
indexed, primary key |
| author_id |
integer |
indexed, not null, foreign key, references users |
| receiver_id |
integer |
indexed, can be self in order to be a user status, foreign key, references users |
| content |
text |
not null |
COMMENTS
| Column Name |
Data Type |
Details |
| id |
integer |
indexed, primary key |
| author_id |
integer |
indexed, not null, foreign key, references users |
| post_id |
integer |
indexed, null allowed, foreign key, references posts |
| content |
text |
not null |
| parent_comment_id |
integer |
foreign key for comments, self-joining, indexed, null if parent comment |
Friend requests will be created with a status of "PENDING". This will be updated once the
requestee accepts or if the requestee declines. Once the requestee accepts, a friendship relation will
be created between the two users and the request will be destroyed.
| Column Name |
Data Type |
Details |
| id |
integer |
primary key, not null |
| user_id |
integer |
indexed, not null, foreign key, references users |
| partner_id |
integer |
indexed, not null, foreign key, references users |
| acceptance |
string |
Initialized with "PENDING" status. Can be changed to "ACCEPTED" if other user accepts or updated to "DECLINED". Won't be deleted. Friends can unfriend and refriend. |
| Column Name |
Data Type |
Details |
| id |
integer |
primary key, not null |
| user_id |
integer |
indexed, not null, foreign key, references users |
| partner_id |
integer |
indexed, not null, foreign key, references users |
[user_id, post_id] combination is unique. Might add another validation in order to prevent the user from liking their own posts. Might consider adding likes for comments too.
| Column Name |
Data Type |
Details |
| id |
integer |
primary key, not null |
| user_id |
integer |
indexed, not null, foreign key |
| post_id |
integer |
indexed, null allowed, foreign key, references posts |
| comment_id |
integer |
indexed, null allowed, foreign key, references comments |