Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database for Online Shop #62

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

vladyslavgusakovskiy
Copy link

No description provided.

Copy link

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

Choose a reason for hiding this comment

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

Thank you for your hard work on this task! Your SQL script is well-structured and meets most of the task requirements. However, there are a few critical issues with the foreign key constraints that need to be addressed before we can approve the pull request:

  1. Foreign Key Constraints: The ON DELETE SET NULL action is used for the ProductID in the OrderItems table, OrderID in the OrderItems table, and CustomerID in the Orders table. However, these columns are not set to allow NULL values. This can lead to potential issues when a referenced record is deleted. Please update these column definitions to allow NULL values.

Once these issues are resolved, your solution will be ready for approval. Keep up the great work, and don't hesitate to reach out if you have any questions! 😊

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

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

ID INT AUTO_INCREMENT,
CustomerID INT,
Date DATE,
FOREIGN KEY (CustomerID) REFERENCES Customers(ID) ON DELETE SET NULL,

Choose a reason for hiding this comment

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

The foreign key constraint on CustomerID in the Orders table uses ON DELETE SET NULL. However, CustomerID is not set to allow NULL values. Consider changing the column definition to CustomerID INT NULL to avoid potential issues.

ID INT AUTO_INCREMENT,
OrderID INT,
ProductID INT,
FOREIGN KEY (OrderID) REFERENCES Orders(ID) ON DELETE SET NULL,

Choose a reason for hiding this comment

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

The foreign key constraint on OrderID in the OrderItems table uses ON DELETE SET NULL. However, OrderID is not set to allow NULL values. Consider changing the column definition to OrderID INT NULL to avoid potential issues.

OrderID INT,
ProductID INT,
FOREIGN KEY (OrderID) REFERENCES Orders(ID) ON DELETE SET NULL,
FOREIGN KEY (ProductID) REFERENCES Products(ID) ON DELETE SET NULL,

Choose a reason for hiding this comment

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

The foreign key constraint on ProductID in the OrderItems table uses ON DELETE SET NULL. However, ProductID is not set to allow NULL values. Consider changing the column definition to ProductID INT NULL to avoid potential issues.

Copy link

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

Choose a reason for hiding this comment

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

The SQL script is well-structured and successfully addresses the previous issues regarding foreign key constraints. The columns CustomerID, OrderID, and ProductID are now set to allow NULL values, aligning with the ON DELETE SET NULL action. This resolves the critical issues previously mentioned. The script now meets the task requirements and constraints as specified.

Great job on making these improvements! 🎉 This decision is made to help you move forward with your learning. Please review the comments to further enhance your code. Remember, addressing such issues in the future will help you avoid similar problems. Keep up the good work and continue learning from your experiences!

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

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.

2 participants