Initial commit
This commit is contained in:
Executable
+21
@@ -0,0 +1,21 @@
|
||||
CREATE TRIGGER IF NOT EXISTS CHK_Bookings_Insert BEFORE INSERT ON Bookings BEGIN
|
||||
SELECT
|
||||
RAISE (
|
||||
FAIL,
|
||||
"Reservation of table is not possible due to the existing reservation"
|
||||
)
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
datetime (NEW.reservation) AS new_res_dt,
|
||||
datetime (reservation) AS res_dt,
|
||||
datetime (reservation, time_reserve) AS reserved_until
|
||||
FROM
|
||||
Bookings
|
||||
)
|
||||
WHERE
|
||||
new_res_dt >= res_dt
|
||||
OR new_res_dt < reserved_until;
|
||||
|
||||
--
|
||||
END;
|
||||
Reference in New Issue
Block a user