From 2e3c5f615bc2fb38dbc27fac7a6e0d06764ff73a Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Sat, 8 Jun 2024 13:53:31 +0400 Subject: [PATCH] cascade comment deletion --- resources/database/cafe_schema.sql | 8 ++++---- resources/database/cafe_test_schema.sql | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/resources/database/cafe_schema.sql b/resources/database/cafe_schema.sql index dc97a7d..33d3c5f 100644 --- a/resources/database/cafe_schema.sql +++ b/resources/database/cafe_schema.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.19 Distrib 10.3.38-MariaDB, for debian-linux-gnu (x86_64) +-- MySQL dump 10.19 Distrib 10.3.39-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: cafe -- ------------------------------------------------------ --- Server version 10.3.38-MariaDB-0ubuntu0.20.04.1 +-- Server version 10.3.39-MariaDB-0ubuntu0.20.04.2 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -79,7 +79,7 @@ CREATE TABLE `comment` ( KEY `comment_comment_comment_id_fk` (`parent_comment_id`), KEY `comment_user_user_id_fk` (`user_id`), KEY `comment_review_review_id_fk` (`review_id`), - CONSTRAINT `comment_comment_comment_id_fk` FOREIGN KEY (`parent_comment_id`) REFERENCES `comment` (`comment_id`), + CONSTRAINT `comment_comment_comment_id_fk` FOREIGN KEY (`parent_comment_id`) REFERENCES `comment` (`comment_id`) ON DELETE CASCADE, CONSTRAINT `comment_review_review_id_fk` FOREIGN KEY (`review_id`) REFERENCES `review` (`review_id`), CONSTRAINT `comment_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; @@ -286,4 +286,4 @@ CREATE TABLE `user` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-05-21 8:07:34 +-- Dump completed on 2024-06-08 13:51:06 diff --git a/resources/database/cafe_test_schema.sql b/resources/database/cafe_test_schema.sql index c3e4a87..cfe4f88 100644 --- a/resources/database/cafe_test_schema.sql +++ b/resources/database/cafe_test_schema.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.19 Distrib 10.3.38-MariaDB, for debian-linux-gnu (x86_64) +-- MySQL dump 10.19 Distrib 10.3.39-MariaDB, for debian-linux-gnu (x86_64) -- -- Host: localhost Database: cafe_test -- ------------------------------------------------------ --- Server version 10.3.38-MariaDB-0ubuntu0.20.04.1 +-- Server version 10.3.39-MariaDB-0ubuntu0.20.04.2 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -79,7 +79,7 @@ CREATE TABLE `comment` ( KEY `comment_comment_comment_id_fk` (`parent_comment_id`), KEY `comment_user_user_id_fk` (`user_id`), KEY `comment_review_review_id_fk` (`review_id`), - CONSTRAINT `comment_comment_comment_id_fk` FOREIGN KEY (`parent_comment_id`) REFERENCES `comment` (`comment_id`), + CONSTRAINT `comment_comment_comment_id_fk` FOREIGN KEY (`parent_comment_id`) REFERENCES `comment` (`comment_id`) ON DELETE CASCADE, CONSTRAINT `comment_review_review_id_fk` FOREIGN KEY (`review_id`) REFERENCES `review` (`review_id`), CONSTRAINT `comment_user_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; @@ -286,4 +286,4 @@ CREATE TABLE `user` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2024-05-21 8:07:34 +-- Dump completed on 2024-06-08 13:51:06