Schema - mmdurnin/TableFor2 GitHub Wiki
users
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null |
email |
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 |
restaurants
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
summary |
text | |
hours |
string | |
dress_code |
string | |
address |
string | |
neighborhood |
string | |
phone_number |
string | |
website |
string | |
city_id |
integer | not null, indexed, foreign key |
pricing |
integer | not null, indexed |
created_at |
datetime | not null |
updated_at |
datetime | not null |
city_id
referencescities
cities
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
state |
string | not null, indexed |
favorites
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
restaurant_id |
integer | not null, indexed, foreign key |
user_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
restaurant_id
referencesrestaurants
user_id
referencesusers
- index on
[:restaurant_id, :user_id], unique: true
reservations
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
restaurant_id |
integer | not null, indexed, foreign key |
user_id |
integer | not null, indexed, foreign key |
starts_at |
datetime | not null, indexed |
num_guests |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
restaurant_id
referencesrestaurants
user_id
referencesusers
reviews
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
restaurant_id |
integer | not null, indexed, foreign key |
user_id |
integer | not null, indexed, foreign key |
rating |
integer | not null, indexed |
body |
text | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
restaurant_id
referencesrestaurants
user_id
referencesusers
- index on
[:restaurant_id, :user_id], unique: true
cuisine_types
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
restaurant_cuisines
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
cuisine_id |
integer | not null, indexed, foreign key |
restaurant_id |
integer | not null, indexed, foreign key |
restaurant_id
referencesrestaurants
cuisine_id
referencescuisines
- index on
[:restaurant_id, :cuisine_id], unique: true