Skip to content

Database Schema

brtsai edited this page Apr 5, 2018 · 15 revisions

Food Help Schema

users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
profile_picture_url string not null
city string not null
state string not null

businesses

column name data type details
id integer not null, primary key
owner_id integer not null, foreign key
name string not null, indexed
neighbourhood string
address string not null
city string not null
state string not null
postal_code integer not null
latitude decimal not null
longitude decimal not null
price decimal not null

business categories

column name data type details
id integer not null, primary key
category string not null, indexed

business category membership

column name data type details
id integer not null, primary key
category_id integer not null, foreign key
business_id integer not null, foreign key

review

column name data type details
id integer not null, primary key
user_id integer not null, foreign key
business_id integer not null, foreign key
rating real not null
review text not null

Bonus: images

column name data type details
id integer not null, primary key
user_id integer not null, foreign key
business_id integer not null, foreign key
image_url integer not null, foreign key
Clone this wiki locally