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)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| property_id | uuid | not null, references properties.id | |
| primary_guest_id | uuid | not null, references guests.id | |
| confirmation_code | varchar(20) | unique, not null | |
| status | booking_status | not null | |
| channel | booking_channel | not null | |
| check_in_date | date | not null | |
| check_out_date | date | not null | |
| adults | smallint | not null | |
| children | smallint | not null | |
| currency | char(3) | not null | |
| room_total_cents | integer | not null | |
| tax_cents | integer | not null | |
| total_cents | integer | not null | |
| special_requests | text | ||
| booked_at | timestamptz | not null | |
| cancelled_at | timestamptz |
Indexes (3)
(property_id, check_in_date)(primary_guest_id, booked_at)(status, check_in_date)
Relationships
bookings.property_idreferencesproperties.idbookings.primary_guest_idreferencesguests.idbooking_rooms.booking_idreferencesbookingspayments.booking_idreferencesbookingsreviews.booking_idreferencesbookings