-
Notifications
You must be signed in to change notification settings - Fork 0
/
sqlcommnd.txt
53 lines (39 loc) · 1.3 KB
/
sqlcommnd.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
ALTER TABLE [dbo].[SubCategories]
DROP CONSTRAINT FK_SubCategory_Category
ALTER TABLE [dbo].[SubCategories]
ADD CONSTRAINT FK_SubCategory_Category
FOREIGN KEY (CategoryId) REFERENCES [dbo].[Categories](Id)
ON DELETE CASCADE;
ALTER TABLE ProductSubCategories
DROP CONSTRAINT FK_ProductSubCategories_Products_ProductId;
ALTER TABLE ProductSubCategories
ADD CONSTRAINT FK_ProductSubCategories_Products_ProductId
FOREIGN KEY (ProductId)
REFERENCES Products (Id)
ON DELETE CASCADE;
ALTER TABLE ProductFacilities
DROP CONSTRAINT FK_ProductFacilities_Products_ProductId;
ALTER TABLE ProductFacilities
ADD CONSTRAINT FK_ProductFacilities_Products_ProductId
FOREIGN KEY (ProductID)
REFERENCES Products (Id)
ON DELETE CASCADE;
ALTER TABLE Images
DROP CONSTRAINT FK_Images_Products_ProductId;
ALTER TABLE Images
ADD CONSTRAINT FK_Images_Products_ProductId
FOREIGN KEY (ProductId)
REFERENCES Products (Id)
ON DELETE CASCADE;
ALTER TABLE OrderItems
DROP CONSTRAINT FK_OrderItems_Products_ProductId;
ALTER TABLE OrderItems
ADD CONSTRAINT FK_OrderItems_Products_ProductId
FOREIGN KEY (ProductId) REFERENCES Products(Id)
ON DELETE CASCADE;
ALTER TABLE Rates
DROP CONSTRAINT FK_Rates_Products_ProductId
ALTER TABLE Rates
ADD CONSTRAINT FK_Rates_Products_ProductId
FOREIGN KEY (ProductId) REFERENCES Products(Id)
ON DELETE SET NULL;