-
Notifications
You must be signed in to change notification settings - Fork 1
Database Schema
tjshiu edited this page Apr 5, 2018
·
22 revisions
| 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 |
image_url |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- Index on
username, unique: true - Index on
session_token, unique: true
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
product_name |
string | not null, indexed |
overview |
text | not null |
description |
text | not null |
cost |
float | not null |
image_url |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- Index on
user_id - Index on
product_name - Index on
[user_id, product_name]unique: true -
user_idreferencesUser
| 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 |
quantity |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- Index on
[user_id, product_id]unique: true -
product_idreferencesProducts -
user_idreferencesUser
| 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 |
rating |
integer | not null, range(0-5) |
comment |
string | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- Index on
[user_id, product_id]unique: true -
product_idreferencesProducts -
user_idreferencesUser