-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
aciffone23 edited this page May 23, 2023
·
5 revisions
| column name | data type | details |
|---|---|---|
id |
bigint | not null, primary key |
username |
string | not null, indexed, unique |
name |
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_many reviewshas_one cart
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, unique |
product_id |
integer | not null, indexed |
quantity |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id - index on
product_id belongs_to userhas_many products
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
brand |
text | not null |
name |
string | not null |
description |
text | not null |
dimensions |
text | |
category |
string | not null |
price |
float | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
has_many reviews
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, unique |
product_id |
integer | not null, indexed |
title |
text | not null |
body |
text | not null |
rating |
float | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
user_id - index on
product_id belongs_to userbelongs_to product