Skip to content

Database Schema

David Alliger edited this page Feb 10, 2022 · 16 revisions

Database Schema

View on dbdiagram.io

Users

name data type constraints
id int primary key, not null
username varchar unique, not null, 30 characters or less
email varchar unique, not null, 256 characters or less
hashedPassword varchar not null
createdAt timestamp not null
updatedAt timestamp not null

Haunts

name data type constraints
id int primary key, not null
userId int foreign key, not null
name varchar not null, 100 characters or less
address varchar not null, 100 characters or less
city varchar not null, 100 characters or less
state varchar 100 characters or less
country varchar not null, 100 characters or less
latitude decimal not null, up to 10 total digits, up to 8 digits after a decimal
longitude decimal not null, up to 11 total digits, up to 8 digits after a decimal
rate decimal not null up to 10 total digits, up to 2 digits after a decimal
description text not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references table Users

Spookings

name data type constraints
id int primary key, not null
userId int foreign key, not null
hauntId int foreign key, not null
startDate datetime not null
endDate datetime not null
polterguests int not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references table Users
  • hauntId references table Spaces

Reviews

name data type constraints
id int primary key, not null
userId int foreign key, not null
hauntId int foreign key, not null
review text not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references table Users
  • hauntId references table Haunts

Images

name data type constraints
id int primary key, not null
userId int foreign key
hauntId int foreign key
url text not null
createdAt timestamp not null
updatedAt timestamp not null
  • userId references table Users
  • hauntId references table Haunts

Clone this wiki locally