Skip to content

Database Schema

UjwalBattar edited this page Apr 11, 2018 · 2 revisions

Database Schema

USERS

column name type details
id integer not_null/PK
first_name string ?
last_name string ?
username string not_null/indexed
email string not_null/indexed
phone string ?
DOB string ?
is_host? boolean not_null
password_digest string not_null
session_token string not_null
created_at datetime not_null
updated_at datetime not_null

LISTINGS

column name type details
id integer not_null/PK
title string not_null/indexed
street_address string not_null/indexed
zip_code integer not_null/indexed
city string not_null/indexed
state string not_null/indexed
country string not_null/indexed
description text not_null
amenities text not_null
rules text not_null
booking boolean(t/f) not_null
host_id integer not_null
latitude float not_null
longitude float not_null
created_at datetime not_null
updated_at datetime not_null

BOOKINGS

column name type details
id integer not_null/PK
booked boolean not_null/indexed?
booker_id integer ?
host_id integer not_null
listing_id integer not_null
from_date date not_null
to_date date not_null
created_at datetime not_null
updated_at datetime not_null

IMAGES

column name type details
id integer not_null/PK
title string not_null/indexed
user_id integer ?
listing_id integer ?
url string not_null
created_at datetime not_null
updated_at datetime not_null

REVIEWS

column name type details
id integer not_null/PK
title string not_null/indexed
body text not_null
rating integer not_null?
reviewer_id integer not_null
listing_id integer not_null
created_at datetime not_null
updated_at datetime not_null
Clone this wiki locally