---\r
--- Table with rooms allowed for booking\r
--- \r
-CREATE TABLE mod_roomreservation_roomswhitelist (\r
- rrr_name TEXT UNIQUE REFERENCES rooms(name)\r
- ON DELETE CASCADE\r
- ON UPDATE CASCADE\r
-);\r
-\r
---\r
--- Table with bookings\r
---\r
-CREATE TABLE mod_roomreservation_bookings (\r
- rrb_uid SERIAL NOT NULL PRIMARY KEY, -- Unique ID \r
- rrb_room TEXT NOT NULL -- Name of the room\r
- REFERENCES rooms(name)\r
- ON DELETE CASCADE\r
- ON UPDATE CASCADE,\r
- rrb_date DATE NOT NULL, -- Date of the booking\r
- rrb_tsfirst SMALLINT NOT NULL, -- Number of the first timeslice\r
- rrb_tslast SMALLINT NOT NULL -- Number of the last timeslice\r
- CHECK(rrb_tsfirst <= rrb_tslast),\r
- rrb_act TEXT NOT NULL -- Owner of the booking\r
- REFERENCES users(Act)\r
- ON DELETE CASCADE\r
- ON UPDATE CASCADE,\r
- rrb_reason TEXT NOT NULL, -- Reason\r
- rrb_interval SMALLINT NOT NULL -- Interval in weeks for recurring bookings\r
- DEFAULT 0\r
-);\r
-\r
---\r
--- Permissions\r
---\r
-GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings, mod_roomreservation_bookings_rrb_uid_seq TO webusr;\r
-GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings, mod_roomreservation_bookings_rrb_uid_seq TO webadm;\r
-GRANT SELECT ON mod_roomreservation_roomswhitelist TO webusr;\r
-GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_roomswhitelist TO webadm;\r
+--
+-- Table with rooms allowed for booking
+--
+CREATE TABLE mod_roomreservation_roomswhitelist (
+ rrr_name TEXT UNIQUE REFERENCES rooms(name)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE
+);
+
+--
+-- Table with bookings
+--
+CREATE TABLE mod_roomreservation_bookings (
+ rrb_uid SERIAL NOT NULL -- Unique ID
+ PRIMARY KEY,
+ rrb_room TEXT NOT NULL -- Name of the room
+ REFERENCES rooms(name)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ rrb_date DATE NOT NULL, -- Date of the booking
+ rrb_tsfirst SMALLINT NOT NULL, -- Number of the first timeslice
+ rrb_tslast SMALLINT NOT NULL -- Number of the last timeslice
+ CHECK(rrb_tsfirst <= rrb_tslast),
+ rrb_act TEXT NOT NULL -- Owner of the booking
+ REFERENCES users(Act)
+ ON DELETE CASCADE
+ ON UPDATE CASCADE,
+ rrb_reason TEXT NOT NULL, -- Reason
+ rrb_interval SMALLINT NOT NULL -- Interval in weeks for
+ DEFAULT 0 -- recurring bookings
+);
+
+--
+-- Permissions
+--
+GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings,
+ mod_roomreservation_bookings_rrb_uid_seq TO webusr;
+GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_bookings,
+ mod_roomreservation_bookings_rrb_uid_seq TO webadm;
+GRANT SELECT ON mod_roomreservation_roomswhitelist TO webusr;
+GRANT SELECT, INSERT, UPDATE, DELETE ON mod_roomreservation_roomswhitelist
+ TO webadm;