-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
DannyRH27 edited this page Jun 26, 2020
·
35 revisions
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
fname |
string | not null |
lname |
string | not null |
email |
string | not null, indexed, unique |
address |
string | indexed |
phone_number |
string | not null, indexed, unique |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
current_order |
integer | |
provider |
string | |
uid |
string | |
name |
string | |
image |
text | |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
:email, unique: true
- index on
:session_token, unique: true
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed, unique |
address |
text | not null |
hours |
text[] | not null |
description |
text | |
status |
ENUM | not null |
coordinate |
point | not null, indexed |
rating |
decimal | not null |
description |
integer | not null |
price_rating |
text | |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
:name
-
:status
could becreated, active, inactive
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
contents |
json | not null |
status |
ENUM | not null |
customer_id |
integer | not null, indexed, foreign key |
store_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
:customer_id
referencesusers
-
:store_id
referencesrestaurants
- index on
:store_id
- index on
:customer_id
-
:status
could bepending, completed, or cancelled
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | not null |
rank |
integer | not null |
store_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
[:store_id, :rank]
-
:store_id
referencesstores
- index on
:store_id
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
menu_id |
integer | not null, foreign key |
item_id |
integer | not null, foreign key |
rank |
integer | not null |
store_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
[:menu_id, :item_id] unique: true
- index on
[:menu_id, :rank] unique: true
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
name |
string | not null, indexed |
description |
text | |
price |
float | not null |
store_id |
integer | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
[:store_id, :name] unique: true
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
category_title |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
:category_title unique: true
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
store_id |
string | not null, indexed, unique |
category_id |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
[:store_id, :category_id], unique: true
- index on
[:category_id, :store_id]
column_name | data type | details |
---|---|---|
id |
integer | not null, primary key |
user_id |
integer | not null, indexed, foreign key |
store_id |
integer | not null, indexed, foreign key |
rating |
integer | not null, indexed |
content |
text | |
created_at |
datetime | not null, indexed |
updated_at |
datetime | not null |
- index on
[:user_id, :store_id]
- index on
:user_id
- index on
:store_id
- index on
:rating
- index on
:created_at