Schema - fullernle/printsy 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 has_onecartassociationhas_manyreviewsassociationhas_manyproducts_in_cartassociationhas_manylistingsassociation
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 |
- index on:
seller_id - index on:
price - index on:
product_name belongs_tosellerassociationhas_manycategoriesassociationhas_manycart_itemsassociation
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 |
- index on:
user_id belongs_touserassociationhas_manycart_itemsassociationhas_manyproductsassociation
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 |
- index on:
user_id - index on:
cart_id - index on:
product_id belongs_tocartassociationbelongs_toproductassociation
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 |
- index on:
product_id, unique: true - index on:
reviewer_id, unique: true - index on:
rating belongs_touserassociationbelongs_toproductassociation
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 |
- index on:
product_id belongs_tocategoryassociationbelongs_toproductassociation
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 |
- index on:
category_id - index on:
name has_manyproduct_categoriesassociation