-
Notifications
You must be signed in to change notification settings - Fork 0
Database Schema
DavidWoolner edited this page Sep 3, 2021
·
22 revisions
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
email |
string | not null, indexed, unique |
password_digest |
string | not null |
session_token |
string | not null, indexed, unique |
first_name |
string | not null, indexed |
last_name |
string | not null, indexed |
birthdate |
date | not null, indexed |
bio |
text | |
created_at |
datetime | not null |
updated_at |
datetime | not null |
- index
email
andsession_token
, with constraints for uniqueness
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
title |
string | not null, unique, indexed |
description |
text | not null |
era_theme |
text | not null |
address |
string | not null |
longitude |
float | not null |
latitude |
float | not null |
num_bedrms |
integer | not null |
num_baths |
integer | not null |
price |
integer | not null |
clean_fee |
integer | not null |
service_fee |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
title
is unique and indexed
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
listing_id |
integer | not null, foreign key, indexed |
booker_id |
integer | not null, foreign key, indexed |
check_in |
date | not null |
check_out |
date | not null |
guests |
integer | not null |
total_price |
float | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
listing_id
andbooker_id
are indexed foreign keys
Associations:
- belongs_to
listing
, foreign key onlisting_id
points to listings - belongs_to
booker
, foreign key onbooker_id
points to users - has_one
host
, throughlisting
source isowner
- has_many
reviews
, foreign key islisting_id
points to reviews
column name | data type | details |
---|---|---|
id |
integer | not null, primary key |
listing_id |
integer | not null, foreign keys, indexed |
author_id |
integer | not null, foreign keys, indexed |
body |
text | not null |
rating |
integer | not null |
created_at |
datetime | not null |
updated_at |
datetime | not null |
-
listing_id
andauthor_id
are indexed foreign keys
Associations:
- belongs_to
author
, foreign key onauthor_id
points to user - belongs_to
listing
, foreign key onauthor_id
points to user