Skip to content

ready for task#124

Open
Illiavyt wants to merge 5 commits into
mate-academy:mainfrom
Illiavyt:main
Open

ready for task#124
Illiavyt wants to merge 5 commits into
mate-academy:mainfrom
Illiavyt:main

Conversation

@Illiavyt

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I’m requesting changes to ensure strict data integrity and alignment with the requirements.

Critical issues to fix:

  • At task.sql, ProductInventory currently allows duplicate rows for the same (ProductID, WarehouseID). This violates the requirement that WarehouseAmount depends on the product+warehouse pair and breaks 3NF. Please add a uniqueness guarantee by either: (a) making (ProductID, WarehouseID) the composite primary key, or (b) keeping the surrogate ID and adding UNIQUE (ProductID, WarehouseID).
  • At task.sql line ~53 (your INSERT into Products), the product name is AwersomeProduct. If the expected sample is AwesomeProduct, correct the spelling so test data matches the expected semantics exactly.

Minor suggestions (optional):

  • Consider preventing negative inventory (e.g., INT UNSIGNED or CHECK (WarehouseAmount >= 0)).
  • Optionally define explicit ON DELETE/ON UPDATE rules and set default table engine/charset.

You’ve done a solid job with schema separation, PKs/FKs, and insertion order—fixing the above will make it fully compliant. Keep going!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql
Comment on lines 28 to +34
CREATE TABLE ProductInventory (
ID INT,
ProductName VARCHAR(50),
WarehouseAmount INT,
WarehouseName VARCHAR(50),
WarehouseAddress VARCHAR(50),
CountryID INT,
FOREIGN KEY (CountryID) REFERENCES Countries(ID) ON DELETE NO ACTION,
PRIMARY KEY (ID)
ID INT AUTO_INCREMENT PRIMARY KEY,
ProductID INT NOT NULL,
WarehouseID INT NOT NULL,
WarehouseAmount INT NOT NULL,
FOREIGN KEY (ProductID) REFERENCES Products(ID),
FOREIGN KEY (WarehouseID) REFERENCES Warehouses(ID)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ProductInventory table uses a surrogate ID but does not enforce uniqueness on the logical key (ProductID, WarehouseID). Per the requirements, the inventory amount must depend on the product+warehouse pair — add a UNIQUE(ProductID, WarehouseID) constraint or make (ProductID, WarehouseID) the composite primary key to prevent duplicate inventory rows and ensure 3NF.

Comment thread task.sql Outdated

-- Товари
INSERT INTO Products (ProductName)
VALUES ('AwersomeProduct');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirm the product name spelling in the INSERT: the script inserts AwersomeProduct. If the original sample expects AwesomeProduct (or another exact spelling), update this INSERT so the test data matches the original semantics exactly.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I’m requesting changes because the script does not meet a critical explicit requirement in the task description. On line 2 of task.sql, you use DROP DATABASE IF EXISTS ShopDB;, but the task requires the script to begin with the exact statement DROP DATABASE ShopDB;. This mismatch may cause automated graders to fail even if the schema is otherwise correct. Please replace line 2 with the exact line DROP DATABASE ShopDB; to satisfy the requirement.

What you did well: the schema is correctly normalized (Countries, Warehouses, Products, ProductInventory), primary/foreign keys and the unique (ProductID, WarehouseID) constraint are set, and non-negative inventory is enforced via INT UNSIGNED (note: older MySQL versions ignore CHECK).

Minor note (no change required): CHECK constraints are ignored in MySQL versions before 8.0.16; relying on INT UNSIGNED is sufficient for non-negativity. After fixing the DROP statement, your solution should fully pass the requirements. Keep up the good work!


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql Outdated
-- Create database and tables

-- Видалення старої бази та створення нової
DROP DATABASE IF EXISTS ShopDB;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task demands the script begin with the exact statement DROP DATABASE ShopDB;. This file uses DROP DATABASE IF EXISTS ShopDB;. Please replace line 2 with the exact required statement DROP DATABASE ShopDB; so the script matches the explicit task instruction (the grader/reviewer may look for this exact line).

Comment thread task.sql
ID INT AUTO_INCREMENT PRIMARY KEY,
ProductID INT NOT NULL,
WarehouseID INT NOT NULL,
WarehouseAmount INT UNSIGNED NOT NULL CHECK (WarehouseAmount >= 0),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You added INT UNSIGNED NOT NULL CHECK (WarehouseAmount >= 0) which is good to prevent negative inventory. Note: older MySQL versions may ignore CHECK constraints, but INT UNSIGNED enforces non-negative values. This is an informational note — no change required unless you need to support very old MySQL versions.

@Losiev Losiev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GJ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants