Skip to content

Database Schema

Brandon Copeland edited this page Mar 15, 2022 · 7 revisions

Schema

image

Tables

users

column name data type details
id integer not null, primary key
email string not null, indexed, unique
firstName string not null, max_length: 20
lastName string not null, max_length: 20
hashed_password string not null
created_at datetime not null
updated_at datetime not null
  • Index on email, unique: true

breweries

column name data type details
id integer not null, primary key
name string not null
address string not null
city string not null
state string not null
zipcode integer not null
phoneNumber string not null
email string not null
host_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null
  • host_id references users Table

images

column name data type details
id integer not null, primary key
image string not null
summary string not null
brewery_id integer not null, foreign key
user_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null
  • user_id references users Table
  • brewery_id references breweries Table

reviews

column name data type details
id integer not null, primary key
content string not null
rating integer not null
user_id integer not null, foreign key
brewery_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null
  • user_id references users Table
  • brewery_id references breweries Table

Clone this wiki locally