Database Schema - michael-berman/Blue-Prints GitHub Wiki

Users

Column Data Type Details
username string not null
email string not null
password_digest string not null
session_token string not null
created_at dateTime not null
updated_at dateTime not null
  • Add index on username
  • has_many projects
  • has_many comments
  • has_many favorites

Projects

Column Data Type Details
title string not null
body string not null
author_id integer not null
category_id integer not null
created_at dateTime not null
updated_at dateTime not null
  • belongs_to author
  • has_many comments (association)
  • has_many pictures (assocation)
  • has_many videos (assocation)
  • has_many steps (assocation)
  • has_many favorites (association)
  • Add index on title (for search by keywords)
  • Add index on author_id
  • Add index on category_id

Steps

Column Data Type Details
header string not null
description string not null
project_id integer not null
created_at dateTime not null
updated_at dateTime not null
  • belongs_to project (association)
  • has_many pictures (association)
  • has_many videos (association)

Comments

Column Data Type Details
body string not null
author_id integer not null
project_id integer not null
created_at dateTime not null
updated_at dateTime not null
  • belongs_to author (association)
  • belongs_to project (association)

Pictures

Column Data Type Details
url string not null
step_id integer not null
created_at dateTime not null
updated_at dateTime not null
  • belongs_to project (association)
  • belongs_to step (association)

Videos

Column Data Type Details
url string not null
step_id integer not null
created_at dateTime not null
updated_at dateTime not null
  • belongs_to project (association)
  • belongs_to step (association)

Bonus Schema

Categories

Column Data Type Details
title string not null
created_at dateTime not null
updated_at dateTime not null
  • Add index on title

Favorites

Column Data Type Details
author_id integer not null
project_id integer not null
created_at dateTime not null
updated_at dateTime not null
  • belongs_to author (association)
  • belongs_to project (association)