I'm wanting to find a way to how I can implement a booking system that lets users put a start date on the booking and generate the end date whenever.
Lets take a house renting example. Say I wanted to book a house from a particular starting date, but I'm not sure when I'll leave, the maximum stay for users who don't put a end date is 3 days, how could I do build my database so there aren't any booking overlaps?
The current structure I have is:
booking
booking_id | integer | not null default nextval('booking_booking_id_seq'::regclass)
houseId | integer |
user_id | integer | not null
booking_date
booking_date_id | integer | not null default nextval('booking_date_booking_date_id_seq'::regclass)
book_from | timestamp without time zone | not null
book_to | timestamp without time zone | not null
booking_id | integer |
I'm wondering whether I store an extra field in the booking entity is_stayAndLeaveWhenever
and then in the booking_date I'd just store the book_to with the book_from + 3 days (max stay without choosing leave date)
Is that a solid solution?
booking
supposed to have multiplebooking_date
?