-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlters.sql
134 lines (84 loc) · 5.25 KB
/
Alters.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
alter table public.tienda
add constraint fklugar foreign key(fklugar) references Lugar(Lug_id);
alter table public.Departamento
add constraint fktienda foreign key(fktienda) references Tienda(Tie_id);
alter table public.Pasillo
add constraint fktienda foreign key(fktienda) references Tienda(Tie_id);
alter table public.Pasillo
add constraint fkproducto foreign key(fkproducto) references Producto(Pro_id);
alter table public.Inventario
add constraint fktienda foreign key(fktienda) references Tienda(Tie_id);
alter table public.Producto
add constraint fksabor foreign key(fksabor) references Sabor(Sab_id);
alter table public.Producto
add constraint fktipo foreign key(fktipo) references Tipo(Tip_id);
alter table public.Pro_inv
add constraint fkproducto foreign key(fkproducto) references Producto(Pro_id);
alter table public.Pro_inv
add constraint fkinventario foreign key(fkinventario) references Inventario(Inv_id);
alter table public.Ing_pro
add constraint fkproducto foreign key(fkproducto) references Producto(Pro_id);
alter table Asistencia
add constraint fkAsistencia_Empleado foreign key (Fkempleado) references Empleado(Emp_id);
alter table public.Ing_pro
add constraint fkingrediente foreign key(fkingrediente) references Ingrediente(Ing_id);
alter table Cliente
add constraint fkTienda foreign key(fkTienda) references Tienda(Tie_id);
alter table Cli_lug
add constraint fkCliente foreign key(fkCliente) references Cliente(Cli_id);
alter table Cli_lug
add constraint fkLugar foreign key(fkLugar) references Lugar(Lug_id);
alter table Lugar
add constraint fkLugar foreign key(fkLugar) references Lugar(Lug_id);
alter table Usuario
add constraint fkCliente foreign key(fkCliente) references Cliente(Cli_id);
alter table Usuario
add constraint fkEmpleado_usuario foreign key(fkEmpleado) references Empleado(Emp_id);
alter table Usuario
add constraint fkRol foreign key(fkRol) references Rol(Rol_id);
alter table Contacto
add constraint fkCliente foreign key(fkCliente) references Cliente(Cli_id);
alter table Telefono
add constraint fkCliente foreign key(fkCliente) references Cliente(Cli_id);
alter table Pedido
add constraint fkCliente foreign key(fkCliente) references Cliente(Cli_id);
alter table Pedido
add constraint fkUsuario foreign key(fkUsuario) references Usuario (Usu_id);
alter table Presupuesto
add constraint fkUsuario foreign key(FkUsuario) references Usuario(Usu_id);
alter table Punto
add constraint fkPedido foreign key(fkPedido) references Pedido(Ped_id);
alter table Punto
add constraint fkUsuario foreign key(fkUsuario) references Usuario(Usu_id);
alter table Punto
add constraint fkHistorial foreign key(fkHistorial) references Punto_historial(Pun_id);
alter table Metodo_Pago
add constraint fkCliente foreign key(fkCliente) references Cliente(Cli_id);
alter table Venta_Pago
add constraint fkPunto foreign key(fkPunto) references Punto(Pun_id);
alter table Venta_Pago
add constraint fkPedido foreign key(fkPedido) references Pedido(Ped_id);
alter table Venta_Pago
add constraint fkMetodo_Pago foreign key(fkMetodo_Pago) references Metodo_Pago(Met_id);
alter table Descuento
add constraint fkDiario foreign key(fkDiario) references Diario(Dia_id);
alter table Descuento
add constraint fkProducto foreign key(fkProducto) references Producto(Pro_id);
alter table Ing_ing add constraint fkIngrediente1 foreign key(FkIngrediente1) references ingrediente(Ing_id);
alter table Ing_ing add constraint fkIngrediente2 foreign key(FkIngrediente2) references ingrediente(Ing_id);
Alter table Ped_pro add constraint fkped_pro_tienda foreign key (FkTienda) references Tienda(Tie_id);
Alter table Ped_pro add constraint fkped_pro_producto foreign key (FkProducto) references Producto(pro_id);
Alter table Ped_pro add constraint fkped_pro_pedido foreign key (FkPedido) references Pedido(ped_id);
Alter table Pedido_tienda add constraint fkpedido_tienda_tienda foreign key (FkTienda) references Tienda(tie_id);
Alter table Pre_pro add constraint fkpre_pro_producto foreign key (FkProducto) references Producto(pro_id);
Alter table Pre_pro add constraint fkpre_pro_presupuesto foreign key (FkPresupuesto) references Presupuesto(pre_id);
Alter table Rol_priv add constraint fkrol_priv_rol foreign key (FkRol) references Rol(rol_id);
Alter table Rol_priv add constraint fkrol_priv_privilegio foreign key (FkPrivilegio) references Privilegio(pri_id);
Alter table Sta_ped add constraint fksta_ped_status foreign key (FkStatus) references Status(sta_id);
Alter table Sta_ped add constraint fksta_ped_pedido foreign key (FkPedido) references Pedido(ped_id);
Alter table Tie_pro add constraint fktie_pro_producto foreign key (FkProducto) references Producto(pro_id);
Alter table Tie_pro add constraint fktie_pro_pedido_tienda foreign key (FkPedido_tienda) references Pedido_tienda(ped_id);
Alter table Tie_sta add constraint fktie_sta_status foreign key (FkStatus) references Status(sta_id);
Alter table Tie_sta add constraint fktie_sta_pedido_tienda foreign key (FkPedido_tienda) references Pedido_tienda (ped_id);
Alter table empleado add constraint fkdepartamento foreign key (fkdepartamento) references departamento(dep_id);
ALTER DATABASE "candyUCAB" SET datestyle TO "ISO, DMY";