-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Elhoussine edited this page Mar 23, 2022
·
8 revisions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
email |
string | not null, unique |
name |
string | not null |
password_digest |
string | not null |
session_token |
string | not null, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true
- index on
session_token, unique: true
has_many products
has_many carts
column Name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, unique |
description |
text | |
created_at |
datetime | not null |
updated_at |
datetime | not null |
has_many products
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
style |
string | |
color |
string | not null |
price |
float | not null |
brand |
string | not null |
image |
string | not null |
description |
text | |
release_date |
date | not null |
seller_id |
integer | not null |
category_id |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
seller_id
- index on
category_id
-
seller_id
referencesusers
-
category_id
referencescategory
belongs_to category
belongs_to user
has_many cart_items
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
status |
string | not null |
amount |
float | not null |
user_id |
integer | not null, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id
-
user_id
referencesusers
belongs_to user
has_many cart_items
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
product_id |
integer | not null, foreign key |
quantity |
integer | not null. |
total |
float | not null. |
cart_id |
integer | not null, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
product_id
- index on
cart_id
-
product_id
referencesproducts
-
cart_id
referencescart
belongs_to cart
belongs_to product