-
Notifications
You must be signed in to change notification settings - Fork 0
Schema
Rudy edited this page Mar 2, 2019
·
16 revisions
| column name | type | details |
|---|---|---|
id |
integer | not null, primary key |
firstname |
string | not null |
lastname |
string | not null |
email |
string | not null, indexed, unique |
session_token |
string | not null, indexed, unique |
password_digest |
string | not null |
- index on email, unique: true
- index on session_token, unique: true
- has_many reviews
| column name | type | details |
|---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
state |
string | not null |
zip |
string | not null |
address |
string | not null |
city |
string | not null |
website |
string | |
price_range |
float | not null |
lat |
float | not null |
lng |
float | not null |
- has_many reviews
| column name | type | details |
|---|---|---|
id |
integer | not null, primary key |
style |
string | not null, unique |
- index on style, unique: true
| column name | type | details |
|---|---|---|
id |
integer | not null, primary key |
restaurant_id |
integer | not null, foreign key |
user_id |
integer | not null, foreign key |
num_stars |
integer | not null |
content |
text | not null |
- belongs_to user
- belongs_to restaurant
| column name | type | details |
|---|---|---|
id |
integer | not null, primary key |
restaurant_id |
integer | not null, foreign key |
style_id |
integer | not null, foreign key |
- join table linking a restaurant to a style
- the combination of restaurant_id and style_id is unique since a restaurant can have the style only once.