Skip to content
This repository has been archived by the owner on Apr 17, 2020. It is now read-only.

Latest commit

 

History

History
83 lines (59 loc) · 1.54 KB

ERD.md

File metadata and controls

83 lines (59 loc) · 1.54 KB

Data architecture documentation

Go back to README

We have decided to use 5 tables: users, posts, comments, reactions, friendships

for a more interactive look check this link


Users

Contains:

  • id int,pk
  • name varchar
  • email varchar
  • password varchar
  • birth_day date
  • bio varchar
  • image_link varchar

Relationships:

  • has_many :authored_posts, foreign_key: :author_id
  • has_many :authored_comments, foreign_key: :author_id
  • has_many :friendships, foreign_key: :user_1
  • has_many :friendships, foreign_key: :user_2
  • has_many :reactions, foreign_key: :author_id

Posts

Contains:

  • id int,pk
  • author_id int
  • content varchar

Relationships:

  • belongs_to :author, foreign_key: :author_id
  • has_many :comments
  • has_many :post_reactions, foreign_key: :post_id

Comments

Contains:

  • id int,pk
  • author_id int
  • post_id int
  • content text

Relationships:

  • belongs_to :author, foreign_key: :author_id
  • belongs_to :post

Reactions

Contains:

  • id int,pk
  • author_id int
  • post_id int

Relationships:

  • belongs_to :author, foreign_key: :author_id
  • belongs_to :post, foreign_key: :post_id

Frienships

Contains:You have implemented the models, but have not implemented the controllers

  • id int,pk
  • accepted boolean
  • user_1 int
  • user_2 int

Relationships:

  • belongs_to :user_1, class_name: :User
  • belongs_to :user_2, class_name: :User