Schema - nancyma713/Bobudget GitHub Wiki

Database Schema

User

column name data type details
id integer not null, primary key
username string not null, indexed, unique
first_name string not null
last_name string not null
zipcode integer not null
budget integer not null
password_digest string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • Purchase will be subtracted from budget

BobaItem

column name data type details
id integer not null, primary key
name string not null
created_at datetime not null
updated_at datetime not null

StoreBobaItem

column name data type details
id integer not null, primary key
boba_item_id integer not null, foreign key
store_id integer not null, foreign key
price integer not null
created_at datetime not null
updated_at datetime not null
  • belongs to a BobaItem
  • belongs to a Store

Store

column name data type details
id integer not null, primary key
name string not null
zipcode integer not null, primary key
owner_id integer not null, foreign key
created_at datetime not null
updated_at datetime not null
  • belongs to a user, through owner_id

Purchase

column name data type details
id integer not null, primary key
boba_item_id integer not null
user_id integer not null
created_at datetime not null
updated_at datetime not null
  • belongs to a BobaItem
  • belongs to a User

Rating

column name data type details
id integer not null, primary key
boba_item_id integer not null
user_id integer not null
created_at datetime not null
updated_at datetime not null
  • belongs to a BobaItem
  • belongs to a User