Skip to content

DB Schema

Alspirid edited this page Jan 31, 2018 · 18 revisions

users

column name data type details
id integer not null, primary key
username string not null, indexed, unique
password_digest string not null
session_token string not null, indexed, unique
d_birth datetime not null
is_host boolean not null
location_id integer not null, foreign key
about_text text
image_url string
email string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • location_id references 'location table'

locations

column name data type details
id integer not null, primary key
street string not null, indexed
area string not null, indexed
lat float not null, indexed
lng float not null, indexed
image_url string not null
created_at datetime not null
updated_at datetime not null

bookings

column name data type details
id integer not null, primary key
traveler_id integer not null, foreign key
host_id integer not null, foreign key
accepted string[accepted,denied,pending]
arrival datetime not null
departure datetime not null
created_at datetime not null
updated_at datetime not null
  • traveler_id references users
  • host_id references users' through 'location
  • location_id references location

reviews

column name data type details
id integer not null, primary key
author_id integer not null, foreign key, indexed
user_id integer not null, foreign key, indexed
location_id integer not null, foreign key, indexed
body text not null
rating integer not null
created_at datetime not null
updated_at datetime not null
  • author_id references users (author of the review)
  • user_id references users (reviewed user)
  • location_id references locations
Clone this wiki locally