bookings table

The bookings table in the Hotel Booking Database Schema schema has 17 columns, keyed by id, with 2 foreign keys to properties and guests. 3 columns in booking_rooms, payments and reviews reference it.

Dates are local calendar dates. Totals are snapshotted at booking time and rolled up from booking_room_nights.

Columns (17)

Columns of the bookings table
ColumnTypeConstraintsDescription
iduuidprimary key
property_iduuidnot null, references properties.id
primary_guest_iduuidnot null, references guests.id
confirmation_codevarchar(20)unique, not null
statusbooking_statusnot null
channelbooking_channelnot null
check_in_datedatenot null
check_out_datedatenot null
adultssmallintnot null
childrensmallintnot null
currencychar(3)not null
room_total_centsintegernot null
tax_centsintegernot null
total_centsintegernot null
special_requeststext
booked_attimestamptznot null
cancelled_attimestamptz

Indexes (3)

  • (property_id, check_in_date)
  • (primary_guest_id, booked_at)
  • (status, check_in_date)

Relationships