feat: cascade on delete for bookings

This commit is contained in:
Timo Ley 2023-06-23 09:53:14 +02:00
parent 7e193adad7
commit 6abfbe17d0

View file

@ -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)
);