Skip to content
P. Dexter Assaf edited this page Dec 18, 2022 · 2 revisions

Postgres Database Schema

users

column name data type details
id integer not null, primary key
firstName string not null, indexed, unique
lastName string not null, indexed, unique
username string not null, indexed, unique
email string not null, indexed, unique
hashedpassword string not null
session_token string not null, indexed, unique
created_at datetime not null
updated_at datetime not null
  • has_many Reviews
  • has_many Spots
  • belongstoMany spots through booking **bonus

spots

column name data type details
id integer not null, primary key
ownnerid integer not null
address string not null
city string not null
state string not null
country string not null
lat integer not null
lng integer not null
name string not null
description string not null
price string not null
created_at datetime not null
updated_at datetime not null
  • ownerid references users
  • has_many Reviews
  • has_many SpotImages
  • belongsto users
  • belongstoMany users through booking **bonus

Review

column name data type details
id integer not null, primary key
spotid integer not null, indexed, foreign key
userid integer not null, indexed, foreign key
review string not null
created_at datetime not null
updated_at datetime not null
stars integer not null
created_at datetime not null
updated_at datetime not null
  • belongsto Ssers
  • belongsto Spots
  • has_many ReviewImages
  • belongs_to chirp
  • belongs_to user
  • spotid references spots
  • userid references users
Clone this wiki locally