Database Schema - skygit97/ConnectMe GitHub Wiki
users
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
session_token |
string | not null, indexed, unique |
password_digest |
string | not null |
first_name |
string | not null |
last_name |
string | not null |
gender |
string | not null |
birthday |
date | not null |
- index on
email, unique: true - index on
session_token, unique: true has_many postshas_many commentshas_many likes
posts
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
author_id |
integer | not null, indexed, foreign key |
content |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
author_idreferencesusers- index on
author_id belongs_to author
comments
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
author_id |
integer | not null, indexed, foreign key |
post_id |
string | not null, indexed, foreign key |
content |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
author_idreferencesusers- index on
author_id belongs_to authorbelongs_to post
likes
| column name | datatype | details |
|---|---|---|
id |
integer | not null, primary key |
liker_id |
integer | not null, indexed, foreign key |
post_id |
string | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
liker_idreferencesuserspost_idreferencesposts- index on [:liker_id, :post_id], unique: true
belongs_to userbelongs_to post