-
Notifications
You must be signed in to change notification settings - Fork 1
schema
caroger edited this page Feb 9, 2021
·
7 revisions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
first_name |
string | not null, indexed |
email |
string | not null, indexed, unique |
address |
text | not null |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true
- index on
session_token, unique: true
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
price |
integer | not null |
description |
text | not null |
seller_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
seller_id
referencesusers
- index on
seller_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
product_id |
integer | not null, indexed, foreign key |
quantities |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
user_id
referencesusers
-
product_id
referencesproducts
- index on
user_id
- index on
product_id
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
product_id |
integer | not null, indexed, foreign key |
reviewer_id |
integer | not null, indexed, foreign key |
rating |
integer | not null |
body |
text | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
product_id
referencesproducts
-
reviewer_id
referencesusers
- index on
[:product_id_id, :reviewer_id], unique: true
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_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 |
-
user_id
referencesusers
-
product_id
referencesproducts
- index on
[:user_id, :product_id], unique: true