Schema - adamLovettApps/LocalPlates GitHub Wiki

Tables

users

Column Name Data Type Contraints
id integer PK, not null
username string unique, not null
hashedPassword string, binary not null
email string unique, not null
profilePhoto string
isOwner boolean

restaurants

Column Name Data Type Constraints
id integer PK, not null
name string not null
address string not null
city string not null
state string not null
zip integer not null
phoneNumber integer not null
owner integer FK (users.id), not null
hours string not null

photos

Column Name Data Type Constraints
id integer PK, not null
photo string not null
restaurantId integer FK (restaurant.id), not null
caption string

menu_photos

Column Name Data Type Constraints
id integer PK, not null
photo string not null
restaurantId integer FK (restaurant.id), not null
updatedAt timestamp not null

reviews

Column Name Data Type Constraints
id integer PK, not null
restaurantId integer FK (restaurant.id), not null
userId integer FK (user.id), not null
body text
stars integer not null
title string not null
image string
createdAt timestamp not null
updatedAt timestamp not null

favorites

Column Name Data Type Constraints
id integer PK, not null
restaurantId integer FK (restaurant.id), not null
userId integer FK (user.id), not null

bookings

Column Name Data Type Constraints
id integer PK, not null
restaurantId integer FK (restaurant.id), not null
userId integer FK (user.id), not null
bookedAt timestamp not null
confirmationStatus integer not null
partySize integer not null
time integer not null
date string not null

tags

Column Name Data Type Constraints
id integer PK, not null
type string unique, not null

restaurant_tags

Column Name Data Type Constraints
id integer PK, not null
tagId integer FK (tag.id), not null
restaurantId integer FK (restaurant.id)