Bonus Schema - Numie/FoodDotCom GitHub Wiki
users
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| first_name | string | not null |
| last_name | string | not null |
| string | not null, unique, indexed | |
| password_digest | string | not null |
| session_token | string | not null, unique, indexed |
| created_at | datetime | not null |
| updated_at | datetime | not null |
restaurants
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| name | string | not null, unique |
| address | string | not null |
| phone | string | not null |
| img_url | string | not null |
| cuisine | string | not null |
| delivery_minimum | float | not null |
| delivery_fee | float | not null, default: 0 |
| open_time | time | not null |
| close_time | time | not null |
| latitude | float | not null |
| longitude | float | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
menu_sections
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| restaurant_id | integer | not null, indexed, foreign_key |
| name | string | not null |
| description | text | |
| open_time | time | not null |
| close_time | time | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
menu_items
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| restaurant_id | integer | not null, indexed, foreign_key |
| menu_section_id | integer | not null, foreign_key |
| name | string | not null |
| description | text | |
| price | float | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
item_option_sections
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| item_id | integer | not null, indexed, foreign_key |
| name | string | not null |
| description | text | |
| required | boolean | inclusion in [true, false], default: false |
| min_allowed | integer | not null |
| max_allowed | integer | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |
item_options
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| item_id | integer | not null, indexed, foreign_key |
| item_option_section_id | integer | not null, foreign_key |
| name | string | not null |
| description | text | |
| price | float | not null, default: 0 |
| created_at | datetime | not null |
| updated_at | datetime | not null |
orders
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| user_id | integer | not null, indexed, foreign_key |
| restaurant_id | integer | not null, indexed, foreign_key |
| subtotal | float | not null |
| tax | float | not null |
| tip | float | |
| delivery fee | float | not null, default: 0 |
| total | float | not null |
| special_instructions | text | |
| created_at | datetime | not null |
| updated_at | datetime | not null |
order_items
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| order_id | integer | not null, indexed, foreign_key |
| item_id | integer | not null, indexed, foreign_key |
| quantity | integer | not null |
| item_instructions | text | |
| created_at | datetime | not null |
| updated_at | datetime | not null |
order_options
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| order_item_id | integer | not null, indexed, foreign_key |
| option_id | integer | not null, indexed, foreign_key |
| created_at | datetime | not null |
| updated_at | datetime | not null |
reviews
| Column Name | Data Type | Details |
|---|---|---|
| id | integer | primary key, not null |
| user_id | integer | not null, indexed, foreign_key |
| restaurant_id | integer | not null, indexed, foreign_key |
| rating | integer | not null |
| review | text | not null |
| created_at | datetime | not null |
| updated_at | datetime | not null |