- rrb_reason TEXT NOT NULL, -- Reason
- rrb_interval SMALLINT NOT NULL -- Interval in weeks for recurring bookings
- DEFAULT 0
+ rrb_reason TEXT NOT NULL, -- Reason
+ rrb_interval SMALLINT NOT NULL -- Interval in weeks for
+ DEFAULT 0 -- recurring bookings
+);
+
+
+--
+-- Table with booking interruptions
+--
+CREATE TABLE mod_roomreservation_intermissions (
+ rri_uid SERIAL NOT NULL -- Unique ID of intermissions
+ PRIMARY KEY,
+ rri_rrb_uid INT NOT NULL -- The boooking to intermit
+ REFERENCES mod_roomreservation_bookings(rrb_uid)
+ ON UPDATE CASCADE ON DELETE CASCADE,
+ -- Note: start and end date form an closed interval, i.e. the start and
+ -- end date are part of the interval.
+ rri_start DATE NOT NULL, -- Start date
+ rri_end DATE NOT NULL -- End date
+ CHECK(rri_start <= rri_end)