booking_rooms table
The booking_rooms table in the Hotel Booking Database Schema schema has 9 columns, keyed by id, with 4 foreign keys to bookings, room_types, rate_plans and rooms. 2 columns in booking_guests and booking_room_nights reference it.
One row per room booked, so a family taking two rooms is one booking. assigned_room_id stays null until check-in.
Columns (9)
| Column | Type | Constraints | Description |
|---|---|---|---|
| id | uuid | primary key | |
| booking_id | uuid | not null, references bookings.id | |
| room_type_id | uuid | not null, references room_types.id | |
| rate_plan_id | uuid | not null, references rate_plans.id | |
| assigned_room_id | uuid | references rooms.id | |
| adults | smallint | not null | |
| children | smallint | not null | |
| checked_in_at | timestamptz | ||
| checked_out_at | timestamptz |
Indexes (2)
(booking_id)(assigned_room_id)
Relationships
booking_rooms.booking_idreferencesbookings.idbooking_rooms.room_type_idreferencesroom_types.idbooking_rooms.rate_plan_idreferencesrate_plans.idbooking_rooms.assigned_room_idreferencesrooms.idbooking_guests.booking_room_idreferencesbooking_roomsbooking_room_nights.booking_room_idreferencesbooking_rooms