Skip to content
dch21 edited this page Nov 7, 2020 · 19 revisions

Postgres Database Schema

users

column name data type details
id integer not null, primary key
email string not null, indexed, unique
first_name string not null
last_name string not null
location string not null
phone_num string indexed
password_digest string not null
session_token string not null, unique, indexed
created_at datetime not null
updated_at datetime not null
  • index on email, unique: true
  • index on phone_num
  • index on session_token, unique: true

restaurants

column name data type details
id integer not null, primary key
name string not null, indexed
description text not null
dining_style string
payment string not null
public_transit string
parking_details string
dress_code string
address text not null
lat float not null
lng float not null
phone_num string not null, indexed
neighborhood string not null
cuisine string not null
price_range string not null
capacity integer not null
boro string
hours string not null
website string not null
created_at datetime not null
updated_at datetime not null
  • index on name
  • index on phone_num

reviews

column name data type details
id integer not null, primary key
review_body text not null
private_note text
food_rating integer not null
noise_level integer not null
service_rating integer not null
ambience_rating integer not null
overall_rating integer not null
restaurant_id integer not null, indexed, foreign key
reviewer_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • index on restaurant_id, references restaurants
  • index on reviewer_id, references users

reservations

column name data type details
id integer not null, primary key
time string not null
date string not null
phone_number string not null
email string not null
occasion time
notes text
party_size integer not null
restaurant_id integer not null, indexed, foreign key
user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • index on restaurant_id, references restaurants
  • index on user_id, references users

favorites

column name data type details
id integer not null, primary key
restaurant_id integer not null, indexed, foreign key
user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • index on restaurant_id, references restaurants
  • index on user_id, references users

Clone this wiki locally