Skip to content

Commit a509839

Browse files
author
Vianpyro
committed
Remove recipe_rating table and related procedures from the database schema
1 parent fa62b7f commit a509839

File tree

7 files changed

+9
-107
lines changed

7 files changed

+9
-107
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ To set up the database locally, you'll need Docker installed. Follow the steps b
1111

1212
1. **Build the Docker Image**:
1313

14-
```bash
15-
docker build -t smartcooking-mariadb .
16-
```
14+
```bash
15+
docker build -t smartcooking-mariadb .
16+
```
1717

1818
2. **Run the Docker Container**:
1919

20-
```bash
21-
docker run -d -p 3306:3306 --name Smart-Cooking_Database -e MYSQL_ROOT_PASSWORD=myrootpassword smartcooking-mariadb
22-
```
20+
```bash
21+
docker run -d -p 3306:3306 --name Smart-Cooking_Database -e MYSQL_ROOT_PASSWORD=myrootpassword smartcooking-mariadb
22+
```
2323

2424
3. **Access the Database**:
2525

26-
```bash
27-
docker exec -it Smart-Cooking_Database mariadb -uroot -pmyrootpassword smartcooking
28-
```
26+
```bash
27+
docker exec -it Smart-Cooking_Database mariadb -uroot -pmyrootpassword smartcooking
28+
```
2929

3030
## Database Schema Overview
3131

@@ -44,7 +44,6 @@ The database schema consists of the following tables:
4444
11. **comment_like**: Tracks likes on comments.
4545
12. **favorite**: Stores information about users' favorite recipes.
4646
13. **recipe_tag**: Represents a many-to-many relationship between recipes and tags.
47-
14. **recipe_rating**: Stores ratings given by users to recipes.
4847
4948
## Usage
5049

database.sql

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -170,13 +170,3 @@ CREATE OR REPLACE TABLE comment_like (
170170
FOREIGN KEY (person_id) REFERENCES person (person_id) ON DELETE CASCADE,
171171
FOREIGN KEY (comment_id) REFERENCES comment (comment_id) ON DELETE CASCADE
172172
) ENGINE = InnoDB;
173-
174-
CREATE OR REPLACE TABLE recipe_rating (
175-
rating_id INT AUTO_INCREMENT PRIMARY KEY,
176-
person_id INT,
177-
recipe_id INT,
178-
rating TINYINT CHECK (rating BETWEEN 1 AND 4),
179-
FOREIGN KEY (person_id) REFERENCES person (person_id) ON DELETE CASCADE,
180-
FOREIGN KEY (recipe_id) REFERENCES recipe (recipe_id) ON DELETE CASCADE,
181-
UNIQUE (person_id, recipe_id)
182-
) ENGINE = InnoDB;

procedures/delete/recipe_rating.sql

Lines changed: 0 additions & 15 deletions
This file was deleted.

procedures/get/recipe.sql

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -111,22 +111,6 @@ BEGIN
111111
);
112112
END //
113113

114-
-- Procedure for retrieving top-rated recipes with pagination
115-
CREATE OR REPLACE PROCEDURE get_top_rated_recipes_paginated(
116-
IN p_min_rating TINYINT,
117-
IN p_limit INT,
118-
IN p_offset INT,
119-
IN p_language_iso_code CHAR(2)
120-
)
121-
BEGIN
122-
CALL get_recipes_paginated(
123-
'INNER JOIN recipe_rating rr ON r.recipe_id = rr.recipe_id',
124-
p_limit, p_offset, p_language_iso_code, 'GROUP BY r.recipe_id',
125-
'HAVING AVG(rr.rating) >= ?',
126-
'ORDER BY AVG(rr.rating) DESC', NULL
127-
);
128-
END //
129-
130114
-- Procedure for retrieving recipes liked by a person with pagination
131115
CREATE OR REPLACE PROCEDURE get_recipes_liked_by_person_paginated(
132116
IN p_person_id INT,

procedures/get/recipe_rating.sql

Lines changed: 0 additions & 27 deletions
This file was deleted.

procedures/insert/recipe_rating.sql

Lines changed: 0 additions & 16 deletions
This file was deleted.

setup/z_mock/recipe_rating.sql

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)