Database Schema - deanmayne/marcheauxpuces GitHub Wiki
users
column name | data type | details |
---|---|---|
id |
integer | not null |
name |
string | not null |
username |
string | not null, indexed, unique |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
username
andsession_token
will be indexed and be unique
products
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
description |
text | not null |
price |
string | not null |
category |
string | not null |
free_shipping |
boolean | not null |
location |
string | not null |
owner_id |
integer | not null, indexed, foreign key |
owner_id
will be indexed.product_id
s will belong to a user referencing theusers
table usingowner_id
.
reviews
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
body |
text | not null |
rating |
integer | not null |
author_id |
integer | not null, indexed, foreign key |
product_id |
integer | not null, indexed, foreign key |
author_id
andproduct_id
will be indexed.- Reviews will belong to a user referencing the
users
table usingauthor_id
. - Reviews will belong to a product referencing the
products
table usingproduct_id
.
carts
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
product_id |
integer | not null, indexed, foreign key |
shopper_id |
integer | not null, indexed, foreign key |
quantity |
integer | not null |
product_id
andshopper_id
will be indexed.- Carts will belong to a user referencing the
users
table usingshopper_id
. - Carts will have many products by referencing the
products
table usingproduct_id
.