fix delete category
This commit is contained in:
@@ -72,6 +72,7 @@ VALUES
|
||||
INSERT INTO
|
||||
Category (Name)
|
||||
VALUES
|
||||
('Other'),
|
||||
('Textbooks'),
|
||||
('Electronics'),
|
||||
('Furniture'),
|
||||
@@ -100,9 +101,8 @@ VALUES
|
||||
('Winter Clothing'),
|
||||
('Photography Equipment'),
|
||||
('Event Tickets'),
|
||||
('Software Licenses'),
|
||||
('Transportation (Car Pool)'),
|
||||
('Other');
|
||||
('Software Licenses');
|
||||
|
||||
|
||||
-- Insert Products
|
||||
INSERT INTO
|
||||
@@ -454,4 +454,5 @@ VALUES
|
||||
1,
|
||||
'This is a great fake product! Totally recommend it.',
|
||||
5,
|
||||
);
|
||||
'2024-10-02 16:00:00'
|
||||
)
|
||||
|
||||
@@ -28,19 +28,6 @@ CREATE TABLE Category (
|
||||
Name VARCHAR(255) NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE Product (
|
||||
ProductID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
Name VARCHAR(255) NOT NULL,
|
||||
Price DECIMAL(10, 2) NOT NULL,
|
||||
StockQuantity INT,
|
||||
UserID INT,
|
||||
Description TEXT,
|
||||
CategoryID INT NOT NULL,
|
||||
Date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (UserID) REFERENCES User (UserID),
|
||||
FOREIGN KEY (CategoryID) REFERENCES Category (CategoryID)
|
||||
);
|
||||
|
||||
-- Product Entity
|
||||
CREATE TABLE Product (
|
||||
ProductID INT AUTO_INCREMENT PRIMARY KEY,
|
||||
@@ -51,7 +38,7 @@ CREATE TABLE Product (
|
||||
Description TEXT,
|
||||
CategoryID INT,
|
||||
Date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (UserID) REFERENCES User (UserID) ON DELETE SET NULL,
|
||||
FOREIGN KEY (UserID) REFERENCES User (UserID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (CategoryID) REFERENCES Category (CategoryID)
|
||||
);
|
||||
|
||||
@@ -73,7 +60,7 @@ CREATE TABLE Review (
|
||||
AND Rating <= 5
|
||||
),
|
||||
Date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
FOREIGN KEY (UserID) REFERENCES User (UserID) ON DELETE SET NULL,
|
||||
FOREIGN KEY (UserID) REFERENCES User (UserID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (ProductID) REFERENCES Product (ProductID) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
@@ -85,7 +72,7 @@ CREATE TABLE Transaction (
|
||||
Date DATETIME DEFAULT CURRENT_TIMESTAMP,
|
||||
PaymentStatus VARCHAR(50),
|
||||
FOREIGN KEY (UserID) REFERENCES User (UserID) ON DELETE CASCADE,
|
||||
FOREIGN KEY (ProductID) REFERENCES Product (ProductID) ON DELETE SET NULL
|
||||
FOREIGN KEY (ProductID) REFERENCES Product (ProductID) ON DELETE CASCADE
|
||||
);
|
||||
|
||||
-- Recommendation Entity (Many-to-One with User, Many-to-One with Product)
|
||||
|
||||
Reference in New Issue
Block a user