-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate2.sql
More file actions
26 lines (21 loc) · 758 Bytes
/
Copy pathupdate2.sql
File metadata and controls
26 lines (21 loc) · 758 Bytes
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
-- 1. Fix the 'apply' table
ALTER TABLE `apply`
DROP FOREIGN KEY `fk_apply_request`;
ALTER TABLE `apply`
ADD CONSTRAINT `fk_apply_request`
FOREIGN KEY (`request_id`) REFERENCES `request` (`request_id`)
ON DELETE CASCADE ON UPDATE CASCADE;
-- 2. Fix the 'assigned' table
ALTER TABLE `assigned`
DROP FOREIGN KEY `fk_assigned_request`;
ALTER TABLE `assigned`
ADD CONSTRAINT `fk_assigned_request`
FOREIGN KEY (`request_id`) REFERENCES `request` (`request_id`)
ON DELETE CASCADE ON UPDATE CASCADE;
-- 3. Fix the 'payment' table
ALTER TABLE `payment`
DROP FOREIGN KEY `fk_payment_request`;
ALTER TABLE `payment`
ADD CONSTRAINT `fk_payment_request`
FOREIGN KEY (`request_id`) REFERENCES `request` (`request_id`)
ON DELETE CASCADE ON UPDATE CASCADE;