-
Notifications
You must be signed in to change notification settings - Fork 9
Database Schema
taisiat edited this page May 4, 2023
·
31 revisions
| column name | date type | details |
|---|---|---|
id |
bigint | not null, primary key |
first_name |
string | not null |
last_name |
string | not null |
approved_to_drive |
boolean | not null, default:true |
is_superhost |
boolean | not null, default:false |
is_clean_certified |
boolean | not null, default:false |
email |
string | not null, indexed, unique |
phone_number |
string | |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
email, unique: true - index on
session_token, unique: true - has_many
trips - has_many
favorites - has_many
reviews - has_many
reviews_for_own_cars - has_many
cars - has_one_attached
photo
| column name | date type | details |
|---|---|---|
id |
bigint | not null, primary key |
make |
string | not null |
model |
string | not null |
year |
integer | not null |
mpg |
integer | not null |
doors_count |
integer | not null |
seats_count |
integer | not null |
category |
string | not null |
automatic |
boolean | not null, default:true |
description |
text | not null |
guidelines |
text | not null |
daily_rate |
integer | not null |
location |
text | array:true |
active |
boolean | not null, default:true |
host_id |
bigint | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
host_idreferencesusers - index on
host_id - belongs_to
host - has_many
trips - has_many
reviews - has_many_attached
photos
| column name | date type | details |
|---|---|---|
id |
bigint | not null, primary key |
start_date |
datetime | not null |
end_date |
datetime | not null |
protection_plan |
string | not null |
driver_id |
bigint | not null, indexed, foreign key |
car_id |
bigint | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
driver_idreferencesusers - index on
driver_id - belongs_to
driver -
car_idreferencescars - index on
car_id - belongs_to
car
| column name | date type | details |
|---|---|---|
id |
bigint | not null, primary key |
cleanliness_rating |
integer | not null |
maintenance_rating |
integer | not null |
communication_rating |
integer | not null |
convenience_rating |
integer | not null |
accuracy_rating |
integer | not null |
comment |
text | not null |
driver_id |
bigint | not null, indexed, foreign key |
car_id |
bigint | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
driver_idreferencesusers - index on
driver_id - belongs_to
driver -
car_idreferencescars - index on
car_id - belongs_to
car -
car_idunique within scope ofdriver_id
| column name | date type | details |
|---|---|---|
id |
bigint | not null, primary key |
driver_id |
bigint | not null, indexed, foreign key |
car_id |
bigint | not null, indexed, foreign key |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
driver_idreferencesusers - index on
driver_id - belongs_to
driver -
car_idreferencescars - index on
car_id - belongs_to
car -
car_idunique within scope ofdriver_id