Database Schema - Muz-98/A-muz-on GitHub Wiki

Users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
email string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • index on username, unique: true
  • index on email, unique: true
  • index on session_token, unique: true

Reviews

Column Name Data Type Details
user_id integer not null, indexed, foreign key
description string not null
rating string not null
product_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • Reviews belong to a user
  • Reviews belong to a product

Cart

Column Name Data Type Details
user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null
  • Cart belong to a user
  • Cart has many product

Product

Column Name Data Type Details
name string not null
description string not null
price integer not null
quantity integer not null
created_at datetime not null
updated_at datetime not null

Product & Cart Joins Table

Column Name Data Type Details
product_id integer not null, indexed, foreign key
cart_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null