-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
Matt Ha edited this page Feb 2, 2018
·
9 revisions
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| username | string | not null, unique |
| string | not null, unique | |
| password_digest | string | not null |
| session_token | string | not null, unique, indexed |
| img_url | string | |
| created_at | datetime | not null |
| updated_at | datetime | not null |
has_many :posts,
has_many :authored_comments
has_many :liked_comments
has_many :liked_posts
has_many :saved_posts
has_many :followed_users
has_many :following_users
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| description | string | |
| img_url | string | not null |
| author_id | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
has_many :comments,
has_many :user_likes
has_many :user_saves
belongs_to :user
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| body | string | not null |
| author_id | string | not null, indexed |
| post_id | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
has_many :user_likes
belongs_to :post
belongs_to :user
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| follower_id | string | not null, indexed |
| followed_id | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
belongs_to :follower
belongs_to :followed_user
| Column | Data Type | Details |
|---|---|---|
| id | integer | not null, primary key |
| post_id | string | not null, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
belongs_to :user
belongs_to :post
belongs_to :id
TODO: Add schema if there is time to implement