-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtriggers.sql
44 lines (37 loc) · 1.06 KB
/
triggers.sql
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
--Classroom Counters Triggers
CREATE TRIGGER check_team_members_counter
BEFORE INSERT OR UPDATE
ON students
FOR EACH ROW
EXECUTE PROCEDURE check_team_members_fun();
CREATE TRIGGER check_team_counter
BEFORE INSERT
ON teams
FOR EACH ROW
EXECUTE PROCEDURE check_class_teams_fun();
/************************* Cascade Delete Triggers *************************/
CREATE TRIGGER cascade_delete_organizations
AFTER UPDATE
ON organizations
FOR EACH ROW
EXECUTE PROCEDURE cascade_delete_organizations_fun();
CREATE TRIGGER cascade_delete_classrooms
AFTER UPDATE
ON classrooms
FOR EACH ROW
EXECUTE PROCEDURE cascade_delete_classrooms_fun();
CREATE TRIGGER cascade_delete_teams
AFTER UPDATE
ON teams
FOR EACH ROW
EXECUTE PROCEDURE cascade_delete_teams_fun();
CREATE TRIGGER cascade_delete_assignments
AFTER UPDATE
ON assignments
FOR EACH ROW
EXECUTE PROCEDURE cascade_delete_assignments_fun();
CREATE TRIGGER cascade_delete_repos
AFTER UPDATE
ON repos
FOR EACH ROW
EXECUTE PROCEDURE cascade_delete_repos_fun();