-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Gregory Del Carlo edited this page Feb 15, 2021
·
12 revisions
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
username |
string | not null, unique, indexed |
password_digest |
string | not null, indexed |
location |
string |
-
Userswill also have a photo held by active storage
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null, unique, indexed |
type |
string | not null |
ABV |
float | not null |
proof |
integer | not null |
description |
text | |
distillery_id |
integer | not null, foreign key, indexed |
-
Drinkswill have many photos held by active storage -
Drinkswill have manyReviews
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
lat |
float | not null, unique |
long |
float | not null, unique |
description |
text |
-
Distillerieswill have manyDrinks
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key, indexed |
rating |
float | not null |
body |
text | not null |
pour |
string | not null, only certain types |
location |
string | |
whiskey_id |
integer | not null, foreign key |
user_id |
integer | not null, foreign key |
-
Reviewswill have manyCommentsandCheers
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
body |
text | not null |
review_id |
integer | not null |
user_id |
integer | not null |
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
user_id |
integer | not null, foreign key |
- User lists need to be unique so we need to add a unique index on [name, user_id]
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, foreign key |
review_id |
integer | not null, foreign key |
-
Cheersact as likes to a comment so it will join a user to a review
| column name | data type | details |
|---|---|---|
id |
integer | not null, primary key |
drink_id |
integer | not null, foreign key |
list_id |
integer | not null, foreign key |
- Users can add whiskeys to their lists so this table joins whiskeys to a list
- A drink can only be added to each list once so we need a unique index on [drink_id, list_id]