-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
AlexDoes edited this page Dec 16, 2021
·
10 revisions
| Column Name | Data Type | Details |
|---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
password_digest |
string | not null |
first_name |
string | not null |
last_name |
string | not null |
session_token |
string | not null, indexed, unique |
bio |
text | optional |
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 |
host_id |
integer | not null, indexed, foreign_key |
title |
string | not null |
description |
text | not null |
location |
string | not null |
guest_limit |
string | not null |
price |
integer | not null |
bedrooms |
integer | not null |
bathrooms |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
host_id -
host_idbelongs_to host -
host_idreferences users
| Column Name | Data Type | Details |
|---|---|---|
id |
integer | not null, primary key |
listing_id |
integer | not null, indexed, foreign_key |
guest_id |
integer | not null, indexed, foreign_key |
number_of_guests |
integer | not null |
check_in_date |
datetime | not null |
check_out_date |
datetime | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
listing_id,guest_id -
listing_idreferences listings -
guest_idreferences users -
listing_idbelongs_to listing -
guest_idbelongs_to guest
| Column Name | Data Type | Details |
|---|---|---|
id |
integer | not null, primary key |
listing_id |
integer | not null, indexed, foreign_key |
guest_id |
integer | not null, indexed, foreign_key |
body |
text | not null |
rating |
integer | not null |
cleanliness |
integer | not null |
communication |
integer | not null |
check_in |
integer | not null |
accuracy |
integer | not null |
location |
integer | not null |
value |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index on
listing_id,guest_id -
listing_idreferences listings -
guest_idreferences users -
listing_idbelongs_to listing -
guest_idbelongs_to guest