Database Schema - RyanGC93/Worldly GitHub Wiki

Database Schema
Worldly uses a postgreSQL Relational Database

User

table
Column Name Data Type Details Default Nullable
id serial PK false
first_name varchar(50) "" (empty string) false
last_name varchar(50) "" (empty string) false
user_name varchar(30) unique false
email varchar(255) unique false
phone_number varchar(15) false
bio text(200) "" (empty string) false
mileage integer 0 false
hashedPassword varchar(60) false
associations
  • User hasMany Reviews via Reviews.userId
  • User hasMany Bookings via Bookings.userId

If User.isEmbassador = true

  • User hasMany events via Event.ownerId

Ambassador

table
Column Name Data Type Details Default Nullable
id serial PK false
user_id integer FK false
associations
  • Ambassador hasMany Events via Events.ambassador_id
  • user_id belongs to users.id

Events

table
Column Name Data Type Details Default Nullable
id serial PK false
ambassador_id integer FK false
description text false
cost integer false
created_at timestamp current_timestamp false
updated_at time stamp current_timestamp false
associations
  • Events hasMany Event_Offerings via Event_Offerings.eventId
  • owner_id references (belongs to) Users.id

Locations

table
Column Name Data Type Details Default Nullable
id serial PK false
event_id integer FK false
longitude float false
latitude float false
city varchar( ) false
country varchar(255) false
continent varchar ( ) false
associations
  • event_id references (belongs to) Events.id

PhotoGallery

table
Column Name Data Type Details Default Nullable
id serial PK false
event_id integer FK false
description text false
url varchar(100) false
associations
  • event_id references (belongs to) Event.id

Event_Calendar

table
Column Name Data Type Details Default Nullable
id serial PK false
event_id integer FK false
date date false
time time with timezone false
created_at timestamp current_timestamp false
updated_at time stamp current_timestamp false
associations
  • event_id references (belongs to) Events.id

Booking_Calendar

table
Column Name Data Type Details Default Nullable
id serial PK false
user_id integer FK false
timeSlot integer FK false
created_at timestamp current_timestamp false
updated_at time stamp current_timestamp false
associations
  • user_id references (belongs to) Users.id
  • timeslot references (belongs to) Event_Calendar.id

Reviews

table
Column Name Data Type Details Default Nullable
id serial PK false
event_id integer FK false
user_id integer FK false
rating integer false
comment varchar(250) false
created_at timestamp current_timestamp false
updated_at time stamp current_timestamp false
associations
  • user_id references (belongs to) Users.id
  • event_d references (belongs to) Events.id

extra | type (event or embassador) | varchar(100) | |

Schema Diagram

⚠️ **GitHub.com Fallback** ⚠️