Schema - lefuller/printsy Wiki

Original URL: https://github.com/lefuller/printsy/wiki/Schema

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

products

column name data type details
id integer not null, primary key
name string not null, indexed
description string not null
price integer not null, indexed
seller_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null

carts

column name data type details
id integer not null, primary key
user_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null

cart_items

column name data type details
id integer not null, primary key
quantity integer not null
cart_id integer not null, indexed, foreign key
product_id integer not null, indexed, foreign key
created_at datetime not null
updated_at datetime not null

reviews

column name data type details
id integer not null, primary key
rating integer not null, indexed
body text not null
product_id integer not null, unique, indexed, foreign key
reviewer_id integer not null, unique, indexed, foreign key
created_at datetime not null
updated_at datetime not null

product_categories

Column Data Type Details
id integer not null, primary key
product_id integer not null, index
created_at datetime not null
updated_at datetime not null

category

Column Data Type Details
id integer not null, primary key
name string not null, index
product_category_id integer index
created_at datetime not null
updated_at datetime not null