Scan to open on your phone
Point a camera at the QR code - it opens this exact paste, no app needed.
https://codepastes.com/zzgs6qm2b409bg6tuntitledPlain Text
tabla,restriccion,definicion
detalles_venta,detalles_venta_cantidad_check,CHECK ((cantidad > 0))
detalles_venta,detalles_venta_pkey,PRIMARY KEY (id)
detalles_venta,detalles_venta_precio_unitario_check,CHECK ((precio_unitario >= (0)::numeric))
detalles_venta,detalles_venta_presentacion_id_fkey,FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT
detalles_venta,detalles_venta_subtotal_check,CHECK ((subtotal >= (0)::numeric))
detalles_venta,detalles_venta_venta_id_fkey,FOREIGN KEY (venta_id) REFERENCES ventas(id) ON DELETE RESTRICT
inventario,inventario_cantidad_disponible_check,CHECK ((cantidad_disponible >= 0))
inventario,inventario_cantidad_reservada_check,CHECK ((cantidad_reservada >= 0))
inventario,inventario_pkey,PRIMARY KEY (id)
inventario,inventario_presentacion_id_fkey,FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT
inventario,inventario_presentacion_id_sede_key,"UNIQUE (presentacion_id, sede)"
inventario,inventario_sede_fkey,FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT
lotes_inventario,lotes_inventario_cantidad_disponible_check,CHECK ((cantidad_disponible >= 0))
lotes_inventario,lotes_inventario_cantidad_inicial_check,CHECK ((cantidad_inicial >= 0))
lotes_inventario,lotes_inventario_cantidad_reservada_check,CHECK ((cantidad_reservada >= 0))
lotes_inventario,lotes_inventario_lote_id_fkey,FOREIGN KEY (lote_id) REFERENCES lotes_produccion(id) ON DELETE RESTRICT
lotes_inventario,lotes_inventario_lote_id_presentacion_id_sede_key,"UNIQUE (lote_id, presentacion_id, sede)"
lotes_inventario,lotes_inventario_pkey,PRIMARY KEY (id)
lotes_inventario,lotes_inventario_presentacion_id_fkey,FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT
lotes_inventario,lotes_inventario_sede_fkey,FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT
lotes_ventas,lotes_ventas_cantidad_check,CHECK ((cantidad > 0))
lotes_ventas,lotes_ventas_detalle_venta_id_fkey,FOREIGN KEY (detalle_venta_id) REFERENCES detalles_venta(id) ON DELETE RESTRICT
lotes_ventas,lotes_ventas_detalle_venta_id_lote_inventario_id_key,"UNIQUE (detalle_venta_id, lote_inventario_id)"
lotes_ventas,lotes_ventas_estado_check,"CHECK ((estado = ANY (ARRAY['RESERVADA'::text, 'VENDIDA'::text, 'CANCELADA'::text])))"
lotes_ventas,lotes_ventas_lote_inventario_id_fkey,FOREIGN KEY (lote_inventario_id) REFERENCES lotes_inventario(id) ON DELETE RESTRICT
lotes_ventas,lotes_ventas_pkey,PRIMARY KEY (id)
lotes_ventas,lotes_ventas_venta_id_fkey,FOREIGN KEY (venta_id) REFERENCES ventas(id) ON DELETE RESTRICT
movimientos_inventario,movimientos_inventario_cantidad_check,CHECK ((cantidad > 0))
movimientos_inventario,movimientos_inventario_pkey,PRIMARY KEY (id)
movimientos_inventario,movimientos_inventario_presentacion_id_fkey,FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT
movimientos_inventario,movimientos_inventario_sede_fkey,FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT
movimientos_inventario,movimientos_inventario_usuario_id_fkey,FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT
pagos_venta,pagos_venta_monto_check,CHECK ((monto > (0)::numeric))
pagos_venta,pagos_venta_pkey,PRIMARY KEY (id)
pagos_venta,pagos_venta_usuario_id_fkey,FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT
pagos_venta,pagos_venta_venta_id_fkey,FOREIGN KEY (venta_id) REFERENCES ventas(id) ON DELETE RESTRICT
ventas,ventas_cliente_id_fkey,FOREIGN KEY (cliente_id) REFERENCES clientes(id) ON DELETE RESTRICT
ventas,ventas_descuento_check,CHECK ((descuento >= (0)::numeric))
ventas,ventas_pkey,PRIMARY KEY (id)
ventas,ventas_sede_fkey,FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT
ventas,ventas_total_check,CHECK ((total >= (0)::numeric))
ventas,ventas_vendedor_id_fkey,FOREIGN KEY (vendedor_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT3,926 chars · codepastes.com