From f6d1376dbb229b183dd5d6d77095f201cd894765 Mon Sep 17 00:00:00 2001 From: Mal <=> Date: Thu, 20 Aug 2020 22:28:22 +0200 Subject: [PATCH] On delete cascades added --- backend/scripts/setup.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/scripts/setup.sql b/backend/scripts/setup.sql index 26aad2b..9a4b0b8 100644 --- a/backend/scripts/setup.sql +++ b/backend/scripts/setup.sql @@ -21,7 +21,7 @@ CREATE TABLE Fingerprint ( PRIMARY KEY (FingerprintId), UNIQUE KEY Fingerprint (Fingerprint), KEY User (UserId), - CONSTRAINT User FOREIGN KEY (UserId) REFERENCES User (UserId) + CONSTRAINT User FOREIGN KEY (UserId) REFERENCES User (UserId) ON DELETE CASCADE ); CREATE TABLE Sharing ( @@ -31,8 +31,8 @@ CREATE TABLE Sharing ( PRIMARY KEY (SharingId), UNIQUE KEY User (User, UserShared), KEY UserSharedId (UserShared), - CONSTRAINT UserId FOREIGN KEY (User) REFERENCES User (UserId), - CONSTRAINT UserSharedId FOREIGN KEY (UserShared) REFERENCES User (UserId) + CONSTRAINT UserId FOREIGN KEY (User) REFERENCES User (UserId) ON DELETE CASCADE, + CONSTRAINT UserSharedId FOREIGN KEY (UserShared) REFERENCES User (UserId) ON DELETE CASCADE ); COMMIT; \ No newline at end of file