Skip to content

Database Schema

Jonathan Bae edited this page Dec 12, 2019 · 10 revisions

users


column name data type details
id integer not null, primary key
full_name string not null
email string not null, indexed
session_token string not null, indexed
password_digest string not null
aboutme text not required, default to ""

hobbies


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

things


column name data type details
id integer not null, primary key
hobby_id integer not null, foreign key
name string not null, indexed
price integer not null
deadline string not required
description text not null

user_hobbies


column name data type details
id integer not null, primary key
hobby_id integer not null, foreign key
user_id integer not null, foreign key
  • add index to user_id and community_id and add uniqueness so a user can't subscribe to a community twice

user_things


column name data type details
id integer not null, primary key
thing_id integer not null, foreign key
user_id integer not null, foreign key
  • add index to user_id and product_id and add uniqueness so a user can't save a product to profile twice

reviews


column name data type details
id integer not null, primary key
thing_id integer not null, foreign key
user_id integer not null, foreign key
body text not null
stars integer not null, from 1 to 5
Clone this wiki locally