Skip to content
Alexandra Savramis edited this page Apr 4, 2018 · 8 revisions

User

Column Name Data Type Details
id integer not null, primary key
firstname string not null
lastname string not null
username string not null, indexed, unique
email string not null
password_digest string not null
session_token string not null, indexed, unique
country_code string optional
phone_number string optional
  • has_many reservations, (references reservation)
  • has_many favorites, (references favorite)
  • has_many restaurants, (through favorites)

Restaurant

Column Name Data Type Details
id integer not null, primary key
name string not null
phone_number string optional
website_link string optional
hours string optional
dining_style string optional
dress_code string optional
executive_chef string optional
description text not null
private_party_facilities string optional
private_party_contact string optional
price_range string optional
  • has_one location, (references location)
  • has_one menu, (references menu)
  • has_many photos, (references photos)
  • has_many users, (through favorites)
  • has_many tags, (through tag join)
  • has_many reviews
  • has_many reservations
  • has_many cuisines, (through cuisine join)
  • has_many payment_option, (through payment_option join)

Review

Column Name Data Type Details
id integer not null, primary key
username string not null (this will not be a reference to the user)
body string not null
rating integer not null
restaurant_id integer not null, foreign key (references restaurant), indexed
  • belongs_to restaurant, (references restaurant)

Reservation

Column Name Data Type Details
id integer not null, primary key
party_size integer not null
date date not null
points integer not null
restaurant_id integer not null, foreign key (references restaurant), indexed
user_id integer not null, foreign key (references user), indexed
  • belong_to user, (references user)
  • belong_to restaurant, (references restaurant)

Location

Column Name Data Type Details
id integer not null, primary key
latitude double not null
longitude double not null
address string optional
neighborhood string optional
cross_street string optional
parking_details string optional
location_image_url string optional
restaurant_id integer not null, foreign key (references restaurant), indexed
  • belongs_to a restaurant

Menu

Column Name Data Type Details
id integer not null, primary key
name string not null
last_update date not null
restaurant_id integer not null, foreign key (references restaurant), indexed
  • belongs_to a restaurant
  • has_many menu_section, (references menu_section)
  • has_many dishes, (through menu_section)

MenuSection

Column Name Data Type Details
id integer not null, primary key
title string optional: true
description string optional: true
menu_id integer not null, foreign key, indexed
  • has_many dishes, (references dish)
  • belongs_to a menu, (references menu)

Dish

Column Name Data Type Details
id integer not null, primary key
name string not null
description string optional: true
price string not null
menu_section_id integer not null, foreign key (references menu_section), indexed
  • belongs_to a menu_section, (references menu_section)

Cuisine

Column Name Data Type Details
id integer not null, primary key
name string not null, unique
  • has_many restaurants (through cuisine join)

RestaurantCuisine

Column Name Data Type Details
id integer not null, primary key
cuisine_id integer not null, foreign key (references cuisine), indexed
restaurant_id integer not null, foreign key (references restaurant), indexed

Payment_Option

Column Name Data Type Details
id integer not null, primary key
name string not null, unique
  • has_many restaurants (through payment_option join)

RestaurantPayment_Option (Join Table)

Column Name Data Type Details
id integer not null, primary key
payment_option_id integer not null, foreign key (references payment_option), indexed
restaurant_id integer not null, foreign key (references restaurant), indexed

Tag

Column Name Data Type Details
id integer not null, primary key
name string not null, unique
  • has_many restaurants through tag join

RestaurantTag (Join Table)

Column Name Data Type Details
id integer not null, primary key
restaurant_id integer not null, foreign key (references restaurant), indexed
tag_id integer not null, foreign key (references tag), indexed

RestaurantFavorite (Join Table)

Column Name Data Type Details
id integer not null, primary key
user_id integer not null, foreign key (references user), indexed
restaurant_id integer not null, foreign key (references restaurant), indexed

Photo

Column Name Data Type Details
id integer not null, primary key
url string not null
restaurant_id integer not null, foreign key (references restaurant), indexed
  • belongs_to a restaurant

Clone this wiki locally