From 6abfbe17d0d0e516417b2900ec9a9632e85071ba Mon Sep 17 00:00:00 2001 From: Timo Ley Date: Fri, 23 Jun 2023 09:53:14 +0200 Subject: [PATCH] feat: cascade on delete for bookings --- SQL/Schema.sql | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SQL/Schema.sql b/SQL/Schema.sql index 4789a2d..4a8125c 100644 --- a/SQL/Schema.sql +++ b/SQL/Schema.sql @@ -92,7 +92,7 @@ CREATE TABLE BookingGuest ( bookingId NUMBER NOT NULL, personId NUMBER NOT NULL, PRIMARY KEY(bookingId, personId), - FOREIGN KEY (bookingId) REFERENCES Booking(bookingId), + FOREIGN KEY (bookingId) REFERENCES Booking(bookingId) ON DELETE CASCADE, FOREIGN KEY (personId) REFERENCES Person(personId) ); @@ -100,7 +100,7 @@ CREATE TABLE BookingRoom ( bookingId NUMBER NOT NULL, roomNumber NUMBER NOT NULL, PRIMARY KEY(bookingId, roomNumber), - FOREIGN KEY (bookingId) REFERENCES Booking(bookingId), + FOREIGN KEY (bookingId) REFERENCES Booking(bookingId) ON DELETE CASCADE, FOREIGN KEY (roomNumber) REFERENCES Room(roomNumber) );