-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDelete_Update_Cascade.sql
38 lines (30 loc) · 1.34 KB
/
Delete_Update_Cascade.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
-- Foreign Key: profesores_coordinaciones_fk
-- ALTER TABLE profesores DROP CONSTRAINT profesores_coordinaciones_fk;
ALTER TABLE profesores
ADD CONSTRAINT profesores_coordinaciones_fk FOREIGN KEY (coordinacion_id)
REFERENCES coordinaciones (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE profesores
ADD CONSTRAINT profesores_periodos_fk FOREIGN KEY (periodo)
REFERENCES periodos (periodo_key) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE profesores
ADD CONSTRAINT profesores_turnos_fk FOREIGN KEY (turno)
REFERENCES turnos (turno_key) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE materias
ADD CONSTRAINT materias_coordinaciones_fk FOREIGN KEY (coordinacion_id)
REFERENCES coordinaciones (id) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE coordinaciones
ADD CONSTRAINT coordinaciones_turnos_fk FOREIGN KEY (turno)
REFERENCES turnos (turno_key) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE usuario_rol
ADD CONSTRAINT role_fk FOREIGN KEY (rol)
REFERENCES roles (rol) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE usuario_rol
ADD CONSTRAINT user_fk FOREIGN KEY (usuario)
REFERENCES usuarios (usuario) MATCH SIMPLE
ON UPDATE CASCADE ON DELETE CASCADE;