untitled

Pasted Nov 15, 2026, 11:41 PM1 file2,829 lines

Scan to open on your phone

Point a camera at the QR code - it opens this exact paste, no app needed.

https://codepastes.com/zzgs48x81rygnmzm
untitled
diagnostico_prestige_clean
"{
    ""RLS"": [
        {
            ""tabla"": ""aromas"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""auditoria_admin"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""cambios_sincronizacion"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""clientes"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""configuracion_sistema"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""control_numeracion_lotes"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""detalles_venta"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""distribucion_produccion"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""inventario"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""lotes_detalle"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""lotes_gastos"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""lotes_inventario"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""lotes_produccion"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""lotes_ventas"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""movimientos_inventario"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""operaciones_sincronizadas"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""pagos_venta"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""permisos_modulos_usuario"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""permisos_usuario"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""presentaciones"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""produccion"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""productos"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""sedes"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        },
        {
            ""tabla"": ""ventas"",
            ""rls_forzado"": false,
            ""rls_habilitado"": true
        }
    ],
    ""INDICES"": [
        {
            ""tabla"": ""aromas"",
            ""indice"": ""aromas_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX aromas_pkey ON public.aromas USING btree (id)""
        },
        {
            ""tabla"": ""aromas"",
            ""indice"": ""idx_aromas_producto"",
            ""definicion"": ""CREATE INDEX idx_aromas_producto ON public.aromas USING btree (producto_id)""
        },
        {
            ""tabla"": ""auditoria_admin"",
            ""indice"": ""auditoria_admin_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX auditoria_admin_pkey ON public.auditoria_admin USING btree (id)""
        },
        {
            ""tabla"": ""auditoria_admin"",
            ""indice"": ""idx_auditoria_administrador"",
            ""definicion"": ""CREATE INDEX idx_auditoria_administrador ON public.auditoria_admin USING btree (administrador_id)""
        },
        {
            ""tabla"": ""auditoria_admin"",
            ""indice"": ""idx_auditoria_fecha"",
            ""definicion"": ""CREATE INDEX idx_auditoria_fecha ON public.auditoria_admin USING btree (fecha DESC)""
        },
        {
            ""tabla"": ""cambios_sincronizacion"",
            ""indice"": ""cambios_sincronizacion_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX cambios_sincronizacion_pkey ON public.cambios_sincronizacion USING btree (id)""
        },
        {
            ""tabla"": ""cambios_sincronizacion"",
            ""indice"": ""idx_cambios_sincronizacion_id"",
            ""definicion"": ""CREATE INDEX idx_cambios_sincronizacion_id ON public.cambios_sincronizacion USING btree (id)""
        },
        {
            ""tabla"": ""clientes"",
            ""indice"": ""clientes_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX clientes_pkey ON public.clientes USING btree (id)""
        },
        {
            ""tabla"": ""clientes"",
            ""indice"": ""idx_clientes_nombre"",
            ""definicion"": ""CREATE INDEX idx_clientes_nombre ON public.clientes USING btree (nombre)""
        },
        {
            ""tabla"": ""clientes"",
            ""indice"": ""idx_clientes_telefono"",
            ""definicion"": ""CREATE INDEX idx_clientes_telefono ON public.clientes USING btree (telefono)""
        },
        {
            ""tabla"": ""configuracion_sistema"",
            ""indice"": ""configuracion_sistema_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX configuracion_sistema_pkey ON public.configuracion_sistema USING btree (id)""
        },
        {
            ""tabla"": ""control_numeracion_lotes"",
            ""indice"": ""control_numeracion_lotes_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX control_numeracion_lotes_pkey ON public.control_numeracion_lotes USING btree (id)""
        },
        {
            ""tabla"": ""detalles_venta"",
            ""indice"": ""detalles_venta_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX detalles_venta_pkey ON public.detalles_venta USING btree (id)""
        },
        {
            ""tabla"": ""detalles_venta"",
            ""indice"": ""idx_detalles_presentacion"",
            ""definicion"": ""CREATE INDEX idx_detalles_presentacion ON public.detalles_venta USING btree (presentacion_id)""
        },
        {
            ""tabla"": ""detalles_venta"",
            ""indice"": ""idx_detalles_venta"",
            ""definicion"": ""CREATE INDEX idx_detalles_venta ON public.detalles_venta USING btree (venta_id)""
        },
        {
            ""tabla"": ""distribucion_produccion"",
            ""indice"": ""distribucion_produccion_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX distribucion_produccion_pkey ON public.distribucion_produccion USING btree (id)""
        },
        {
            ""tabla"": ""distribucion_produccion"",
            ""indice"": ""idx_distribucion_produccion"",
            ""definicion"": ""CREATE INDEX idx_distribucion_produccion ON public.distribucion_produccion USING btree (produccion_id)""
        },
        {
            ""tabla"": ""distribucion_produccion"",
            ""indice"": ""idx_distribucion_sede"",
            ""definicion"": ""CREATE INDEX idx_distribucion_sede ON public.distribucion_produccion USING btree (sede)""
        },
        {
            ""tabla"": ""inventario"",
            ""indice"": ""idx_inventario_sede"",
            ""definicion"": ""CREATE INDEX idx_inventario_sede ON public.inventario USING btree (sede)""
        },
        {
            ""tabla"": ""inventario"",
            ""indice"": ""inventario_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX inventario_pkey ON public.inventario USING btree (id)""
        },
        {
            ""tabla"": ""inventario"",
            ""indice"": ""inventario_presentacion_id_sede_key"",
            ""definicion"": ""CREATE UNIQUE INDEX inventario_presentacion_id_sede_key ON public.inventario USING btree (presentacion_id, sede)""
        },
        {
            ""tabla"": ""lotes_detalle"",
            ""indice"": ""idx_lotes_detalle_lote"",
            ""definicion"": ""CREATE INDEX idx_lotes_detalle_lote ON public.lotes_detalle USING btree (lote_id)""
        },
        {
            ""tabla"": ""lotes_detalle"",
            ""indice"": ""lotes_detalle_lote_id_presentacion_id_key"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_detalle_lote_id_presentacion_id_key ON public.lotes_detalle USING btree (lote_id, presentacion_id)""
        },
        {
            ""tabla"": ""lotes_detalle"",
            ""indice"": ""lotes_detalle_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_detalle_pkey ON public.lotes_detalle USING btree (id)""
        },
        {
            ""tabla"": ""lotes_gastos"",
            ""indice"": ""idx_lotes_gastos_lote"",
            ""definicion"": ""CREATE INDEX idx_lotes_gastos_lote ON public.lotes_gastos USING btree (lote_id)""
        },
        {
            ""tabla"": ""lotes_gastos"",
            ""indice"": ""lotes_gastos_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_gastos_pkey ON public.lotes_gastos USING btree (id)""
        },
        {
            ""tabla"": ""lotes_inventario"",
            ""indice"": ""idx_lotes_inventario_lote"",
            ""definicion"": ""CREATE INDEX idx_lotes_inventario_lote ON public.lotes_inventario USING btree (lote_id)""
        },
        {
            ""tabla"": ""lotes_inventario"",
            ""indice"": ""idx_lotes_inventario_presentacion"",
            ""definicion"": ""CREATE INDEX idx_lotes_inventario_presentacion ON public.lotes_inventario USING btree (presentacion_id)""
        },
        {
            ""tabla"": ""lotes_inventario"",
            ""indice"": ""idx_lotes_inventario_sede"",
            ""definicion"": ""CREATE INDEX idx_lotes_inventario_sede ON public.lotes_inventario USING btree (sede)""
        },
        {
            ""tabla"": ""lotes_inventario"",
            ""indice"": ""lotes_inventario_lote_id_presentacion_id_sede_key"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_inventario_lote_id_presentacion_id_sede_key ON public.lotes_inventario USING btree (lote_id, presentacion_id, sede)""
        },
        {
            ""tabla"": ""lotes_inventario"",
            ""indice"": ""lotes_inventario_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_inventario_pkey ON public.lotes_inventario USING btree (id)""
        },
        {
            ""tabla"": ""lotes_produccion"",
            ""indice"": ""idx_lotes_aroma"",
            ""definicion"": ""CREATE INDEX idx_lotes_aroma ON public.lotes_produccion USING btree (aroma_id)""
        },
        {
            ""tabla"": ""lotes_produccion"",
            ""indice"": ""idx_lotes_fecha"",
            ""definicion"": ""CREATE INDEX idx_lotes_fecha ON public.lotes_produccion USING btree (fecha_creacion DESC)""
        },
        {
            ""tabla"": ""lotes_produccion"",
            ""indice"": ""idx_lotes_producto"",
            ""definicion"": ""CREATE INDEX idx_lotes_producto ON public.lotes_produccion USING btree (producto_id)""
        },
        {
            ""tabla"": ""lotes_produccion"",
            ""indice"": ""lotes_produccion_numero_lote_key"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_produccion_numero_lote_key ON public.lotes_produccion USING btree (numero_lote)""
        },
        {
            ""tabla"": ""lotes_produccion"",
            ""indice"": ""lotes_produccion_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_produccion_pkey ON public.lotes_produccion USING btree (id)""
        },
        {
            ""tabla"": ""lotes_ventas"",
            ""indice"": ""idx_lotes_ventas_detalle"",
            ""definicion"": ""CREATE INDEX idx_lotes_ventas_detalle ON public.lotes_ventas USING btree (detalle_venta_id)""
        },
        {
            ""tabla"": ""lotes_ventas"",
            ""indice"": ""idx_lotes_ventas_inventario"",
            ""definicion"": ""CREATE INDEX idx_lotes_ventas_inventario ON public.lotes_ventas USING btree (lote_inventario_id)""
        },
        {
            ""tabla"": ""lotes_ventas"",
            ""indice"": ""idx_lotes_ventas_venta"",
            ""definicion"": ""CREATE INDEX idx_lotes_ventas_venta ON public.lotes_ventas USING btree (venta_id)""
        },
        {
            ""tabla"": ""lotes_ventas"",
            ""indice"": ""lotes_ventas_detalle_venta_id_lote_inventario_id_key"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_ventas_detalle_venta_id_lote_inventario_id_key ON public.lotes_ventas USING btree (detalle_venta_id, lote_inventario_id)""
        },
        {
            ""tabla"": ""lotes_ventas"",
            ""indice"": ""lotes_ventas_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX lotes_ventas_pkey ON public.lotes_ventas USING btree (id)""
        },
        {
            ""tabla"": ""movimientos_inventario"",
            ""indice"": ""idx_movimientos_fecha"",
            ""definicion"": ""CREATE INDEX idx_movimientos_fecha ON public.movimientos_inventario USING btree (fecha_creacion DESC)""
        },
        {
            ""tabla"": ""movimientos_inventario"",
            ""indice"": ""idx_movimientos_presentacion"",
            ""definicion"": ""CREATE INDEX idx_movimientos_presentacion ON public.movimientos_inventario USING btree (presentacion_id)""
        },
        {
            ""tabla"": ""movimientos_inventario"",
            ""indice"": ""idx_movimientos_referencia"",
            ""definicion"": ""CREATE INDEX idx_movimientos_referencia ON public.movimientos_inventario USING btree (referencia_id)""
        },
        {
            ""tabla"": ""movimientos_inventario"",
            ""indice"": ""idx_movimientos_sede"",
            ""definicion"": ""CREATE INDEX idx_movimientos_sede ON public.movimientos_inventario USING btree (sede)""
        },
        {
            ""tabla"": ""movimientos_inventario"",
            ""indice"": ""movimientos_inventario_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX movimientos_inventario_pkey ON public.movimientos_inventario USING btree (id)""
        },
        {
            ""tabla"": ""operaciones_sincronizadas"",
            ""indice"": ""operaciones_sincronizadas_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX operaciones_sincronizadas_pkey ON public.operaciones_sincronizadas USING btree (id)""
        },
        {
            ""tabla"": ""operaciones_sincronizadas"",
            ""indice"": ""operaciones_sincronizadas_usuario_operacion_unique"",
            ""definicion"": ""CREATE UNIQUE INDEX operaciones_sincronizadas_usuario_operacion_unique ON public.operaciones_sincronizadas USING btree (usuario_id, id)""
        },
        {
            ""tabla"": ""pagos_venta"",
            ""indice"": ""idx_pagos_fecha"",
            ""definicion"": ""CREATE INDEX idx_pagos_fecha ON public.pagos_venta USING btree (fecha_creacion DESC)""
        },
        {
            ""tabla"": ""pagos_venta"",
            ""indice"": ""idx_pagos_venta"",
            ""definicion"": ""CREATE INDEX idx_pagos_venta ON public.pagos_venta USING btree (venta_id)""
        },
        {
            ""tabla"": ""pagos_venta"",
            ""indice"": ""pagos_venta_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX pagos_venta_pkey ON public.pagos_venta USING btree (id)""
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""indice"": ""perfiles_usuario_correo_key"",
            ""definicion"": ""CREATE UNIQUE INDEX perfiles_usuario_correo_key ON public.perfiles_usuario USING btree (correo)""
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""indice"": ""perfiles_usuario_nombre_usuario_unique"",
            ""definicion"": ""CREATE UNIQUE INDEX perfiles_usuario_nombre_usuario_unique ON public.perfiles_usuario USING btree (lower(nombre_usuario)) WHERE (nombre_usuario IS NOT NULL)""
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""indice"": ""perfiles_usuario_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX perfiles_usuario_pkey ON public.perfiles_usuario USING btree (id)""
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""indice"": ""un_solo_admin_principal"",
            ""definicion"": ""CREATE UNIQUE INDEX un_solo_admin_principal ON public.perfiles_usuario USING btree (rol) WHERE (rol = 'administrador_principal'::text)""
        },
        {
            ""tabla"": ""permisos_modulos_usuario"",
            ""indice"": ""permiso_modulo_unico"",
            ""definicion"": ""CREATE UNIQUE INDEX permiso_modulo_unico ON public.permisos_modulos_usuario USING btree (usuario_id, modulo)""
        },
        {
            ""tabla"": ""permisos_modulos_usuario"",
            ""indice"": ""permisos_modulos_usuario_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX permisos_modulos_usuario_pkey ON public.permisos_modulos_usuario USING btree (id)""
        },
        {
            ""tabla"": ""permisos_usuario"",
            ""indice"": ""idx_permisos_usuario"",
            ""definicion"": ""CREATE INDEX idx_permisos_usuario ON public.permisos_usuario USING btree (usuario_id)""
        },
        {
            ""tabla"": ""permisos_usuario"",
            ""indice"": ""permisos_usuario_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX permisos_usuario_pkey ON public.permisos_usuario USING btree (id)""
        },
        {
            ""tabla"": ""permisos_usuario"",
            ""indice"": ""permisos_usuario_usuario_id_modulo_accion_key"",
            ""definicion"": ""CREATE UNIQUE INDEX permisos_usuario_usuario_id_modulo_accion_key ON public.permisos_usuario USING btree (usuario_id, modulo, accion)""
        },
        {
            ""tabla"": ""presentaciones"",
            ""indice"": ""idx_presentaciones_aroma"",
            ""definicion"": ""CREATE INDEX idx_presentaciones_aroma ON public.presentaciones USING btree (aroma_id)""
        },
        {
            ""tabla"": ""presentaciones"",
            ""indice"": ""presentaciones_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX presentaciones_pkey ON public.presentaciones USING btree (id)""
        },
        {
            ""tabla"": ""produccion"",
            ""indice"": ""idx_produccion_fecha"",
            ""definicion"": ""CREATE INDEX idx_produccion_fecha ON public.produccion USING btree (fecha_creacion DESC)""
        },
        {
            ""tabla"": ""produccion"",
            ""indice"": ""idx_produccion_presentacion"",
            ""definicion"": ""CREATE INDEX idx_produccion_presentacion ON public.produccion USING btree (presentacion_id)""
        },
        {
            ""tabla"": ""produccion"",
            ""indice"": ""produccion_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX produccion_pkey ON public.produccion USING btree (id)""
        },
        {
            ""tabla"": ""productos"",
            ""indice"": ""productos_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX productos_pkey ON public.productos USING btree (id)""
        },
        {
            ""tabla"": ""sedes"",
            ""indice"": ""sedes_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX sedes_pkey ON public.sedes USING btree (codigo)""
        },
        {
            ""tabla"": ""ventas"",
            ""indice"": ""idx_ventas_cliente"",
            ""definicion"": ""CREATE INDEX idx_ventas_cliente ON public.ventas USING btree (cliente_id)""
        },
        {
            ""tabla"": ""ventas"",
            ""indice"": ""idx_ventas_estado"",
            ""definicion"": ""CREATE INDEX idx_ventas_estado ON public.ventas USING btree (estado_entrega)""
        },
        {
            ""tabla"": ""ventas"",
            ""indice"": ""idx_ventas_fecha"",
            ""definicion"": ""CREATE INDEX idx_ventas_fecha ON public.ventas USING btree (fecha_creacion DESC)""
        },
        {
            ""tabla"": ""ventas"",
            ""indice"": ""idx_ventas_sede"",
            ""definicion"": ""CREATE INDEX idx_ventas_sede ON public.ventas USING btree (sede)""
        },
        {
            ""tabla"": ""ventas"",
            ""indice"": ""idx_ventas_vendedor"",
            ""definicion"": ""CREATE INDEX idx_ventas_vendedor ON public.ventas USING btree (vendedor_id)""
        },
        {
            ""tabla"": ""ventas"",
            ""indice"": ""ventas_pkey"",
            ""definicion"": ""CREATE UNIQUE INDEX ventas_pkey ON public.ventas USING btree (id)""
        }
    ],
    ""TRIGGERS"": [
        {
            ""tabla"": ""aromas"",
            ""evento"": ""INSERT"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_aromas"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""aromas"",
            ""evento"": ""UPDATE"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_aromas"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""aromas"",
            ""evento"": ""DELETE"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_aromas"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""configuracion_sistema"",
            ""evento"": ""UPDATE"",
            ""momento"": ""BEFORE"",
            ""trigger"": ""proteger_configuracion_sistema_trigger"",
            ""definicion"": ""EXECUTE FUNCTION proteger_configuracion_sistema()""
        },
        {
            ""tabla"": ""configuracion_sistema"",
            ""evento"": ""DELETE"",
            ""momento"": ""BEFORE"",
            ""trigger"": ""proteger_configuracion_sistema_trigger"",
            ""definicion"": ""EXECUTE FUNCTION proteger_configuracion_sistema()""
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""evento"": ""DELETE"",
            ""momento"": ""BEFORE"",
            ""trigger"": ""proteger_admin_principal_trigger"",
            ""definicion"": ""EXECUTE FUNCTION proteger_admin_principal()""
        },
        {
            ""tabla"": ""perfiles_usuario"",
            ""evento"": ""UPDATE"",
            ""momento"": ""BEFORE"",
            ""trigger"": ""proteger_admin_principal_trigger"",
            ""definicion"": ""EXECUTE FUNCTION proteger_admin_principal()""
        },
        {
            ""tabla"": ""presentaciones"",
            ""evento"": ""UPDATE"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_presentaciones"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""presentaciones"",
            ""evento"": ""INSERT"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_presentaciones"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""presentaciones"",
            ""evento"": ""DELETE"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_presentaciones"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""productos"",
            ""evento"": ""INSERT"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_productos"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""productos"",
            ""evento"": ""UPDATE"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_productos"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        },
        {
            ""tabla"": ""productos"",
            ""evento"": ""DELETE"",
            ""momento"": ""AFTER"",
            ""trigger"": ""trigger_cambios_productos"",
            ""definicion"": ""EXECUTE FUNCTION registrar_cambio_sincronizacion()""
        }
    ],
    ""FUNCIONES"": [
        {
            ""nombre"": ""tiene_permiso"",
            ""retorno"": ""boolean"",
            ""argumentos"": ""p_modulo text, p_accion text"",
            ""definicion"": ""CREATE OR REPLACE FUNCTION public.tiene_permiso(p_modulo text, p_accion text)\n RETURNS boolean\n LANGUAGE sql\n STABLE SECURITY DEFINER\n SET search_path TO ''\nAS $function$\r\n    SELECT\r\n        public.usuario_activo()\r\n        AND (\r\n            -- Administrador principal: acceso completo.\r\n            EXISTS (\r\n                SELECT 1\r\n                FROM public.configuracion_sistema cs\r\n                WHERE cs.administrador_principal_id = (SELECT auth.uid())\r\n            )\r\n\r\n            OR\r\n\r\n            -- Auditoría: administradores.\r\n            (\r\n                lower(p_modulo) = 'auditoria'\r\n                AND EXISTS (\r\n                    SELECT 1\r\n                    FROM public.perfiles_usuario pu\r\n                    WHERE pu.id = (SELECT auth.uid())\r\n                      AND pu.rol IN (\r\n                          'administrador_principal',\r\n                          'administrador_secundario'\r\n                      )\r\n                      AND pu.estado = 'activo'\r\n                )\r\n            )\r\n\r\n            OR\r\n\r\n            -- Acceso completo a los módulos asignados.\r\n            EXISTS (\r\n                SELECT 1\r\n                FROM public.permisos_modulos_usuario pm\r\n                WHERE pm.usuario_id = (SELECT auth.uid())\r\n                  AND pm.modulo = CASE lower(p_modulo)\r\n                      WHEN 'productos' THEN 'Productos'\r\n                      WHEN 'aromas' THEN 'Productos'\r\n                      WHEN 'clientes' THEN 'Clientes'\r\n                      WHEN 'ventas' THEN 'Ventas'\r\n                      WHEN 'pagos' THEN 'Ventas'\r\n                      WHEN 'produccion' THEN 'Producción'\r\n                      WHEN 'distribucion_produccion' THEN 'Producción'\r\n                      WHEN 'inventario' THEN 'Inventario'\r\n                      WHEN 'lotes' THEN 'Lotes'\r\n                      ELSE NULL\r\n                  END\r\n            )\r\n        );\r\n$function$\n""
        },
        {
            ""nombre"": ""usuario_activo"",
            ""retorno"": ""boolean"",
            ""argumentos"": """",
            ""definicion"": ""CREATE OR REPLACE FUNCTION public.usuario_activo()\n RETURNS boolean\n LANGUAGE sql\n STABLE SECURITY DEFINER\n SET search_path TO ''\nAS $function$\r\n    SELECT EXISTS (\r\n        SELECT 1\r\n        FROM public.perfiles_usuario\r\n        WHERE id = (SELECT auth.uid())\r\n          AND estado = 'activo'\r\n    );\r\n$function$\n""
        }
    ],
    ""POLITICAS_RLS"": [
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""aromas"",
            ""using"": ""tiene_permiso('productos'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_aromas"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""auditoria_admin"",
            ""using"": ""tiene_permiso('auditoria'::text, 'ver_auditoria'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""administradores_consultan_auditoria"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""clientes"",
            ""using"": ""tiene_permiso('clientes'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_clientes"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""detalles_venta"",
            ""using"": ""tiene_permiso('ventas'::text, 'ver_historial'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_detalles_venta"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""distribucion_produccion"",
            ""using"": ""tiene_permiso('produccion'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_distribucion"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""inventario"",
            ""using"": ""tiene_permiso('inventario'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_inventario"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""lotes_detalle"",
            ""using"": ""tiene_permiso('lotes'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_lotes_detalle"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""lotes_gastos"",
            ""using"": ""tiene_permiso('lotes'::text, 'ver_costos'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_lotes_gastos"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""lotes_inventario"",
            ""using"": ""tiene_permiso('lotes'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_lotes_inventario"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""lotes_produccion"",
            ""using"": ""tiene_permiso('lotes'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_lotes_produccion"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""lotes_ventas"",
            ""using"": ""tiene_permiso('lotes'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_lotes_ventas"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""movimientos_inventario"",
            ""using"": ""tiene_permiso('inventario'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_movimientos"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""pagos_venta"",
            ""using"": ""tiene_permiso('pagos'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_pagos"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""perfiles_usuario"",
            ""using"": ""(id = ( SELECT auth.uid() AS uid))"",
            ""comando"": ""SELECT"",
            ""politica"": ""usuario_consulta_su_perfil"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""permisos_usuario"",
            ""using"": ""(usuario_id = ( SELECT auth.uid() AS uid))"",
            ""comando"": ""SELECT"",
            ""politica"": ""usuario_consulta_sus_permisos"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""presentaciones"",
            ""using"": ""tiene_permiso('productos'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_presentaciones"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""produccion"",
            ""using"": ""tiene_permiso('produccion'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_produccion"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""productos"",
            ""using"": ""tiene_permiso('productos'::text, 'ver'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_productos"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""sedes"",
            ""using"": ""usuario_activo()"",
            ""comando"": ""SELECT"",
            ""politica"": ""usuarios_activos_consultan_sedes"",
            ""with_check"": null
        },
        {
            ""roles"": [
                ""authenticated""
            ],
            ""tabla"": ""ventas"",
            ""using"": ""tiene_permiso('ventas'::text, 'ver_historial'::text)"",
            ""comando"": ""SELECT"",
            ""politica"": ""consultar_ventas"",
            ""with_check"": null
        }
    ],
    ""RESTRICCIONES"": [
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""aromas"",
            ""nombre"": ""aromas_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""aromas"",
            ""nombre"": ""aromas_producto_id_fkey"",
            ""definicion"": ""FOREIGN KEY (producto_id) REFERENCES productos(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""auditoria_admin"",
            ""nombre"": ""auditoria_admin_administrador_id_fkey"",
            ""definicion"": ""FOREIGN KEY (administrador_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""auditoria_admin"",
            ""nombre"": ""auditoria_admin_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""auditoria_admin"",
            ""nombre"": ""auditoria_admin_usuario_afectado_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_afectado_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""cambios_sincronizacion"",
            ""nombre"": ""cambios_sincronizacion_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""clientes"",
            ""nombre"": ""clientes_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""clientes"",
            ""nombre"": ""clientes_usuario_creador_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_creador_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""configuracion_sistema"",
            ""nombre"": ""configuracion_sistema_administrador_principal_id_fkey"",
            ""definicion"": ""FOREIGN KEY (administrador_principal_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""configuracion_sistema"",
            ""nombre"": ""configuracion_sistema_id_check"",
            ""definicion"": ""CHECK ((id = true))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""configuracion_sistema"",
            ""nombre"": ""configuracion_sistema_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""control_numeracion_lotes"",
            ""nombre"": ""control_numeracion_lotes_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""control_numeracion_lotes"",
            ""nombre"": ""control_numeracion_lotes_ultimo_numero_check"",
            ""definicion"": ""CHECK ((ultimo_numero >= 0))""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""detalles_venta"",
            ""nombre"": ""detalles_venta_cantidad_check"",
            ""definicion"": ""CHECK ((cantidad > 0))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""detalles_venta"",
            ""nombre"": ""detalles_venta_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""detalles_venta"",
            ""nombre"": ""detalles_venta_precio_unitario_check"",
            ""definicion"": ""CHECK ((precio_unitario >= (0)::numeric))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""detalles_venta"",
            ""nombre"": ""detalles_venta_presentacion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""detalles_venta"",
            ""nombre"": ""detalles_venta_subtotal_check"",
            ""definicion"": ""CHECK ((subtotal >= (0)::numeric))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""detalles_venta"",
            ""nombre"": ""detalles_venta_venta_id_fkey"",
            ""definicion"": ""FOREIGN KEY (venta_id) REFERENCES ventas(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""distribucion_produccion"",
            ""nombre"": ""distribucion_produccion_cantidad_check"",
            ""definicion"": ""CHECK ((cantidad > 0))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""distribucion_produccion"",
            ""nombre"": ""distribucion_produccion_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""distribucion_produccion"",
            ""nombre"": ""distribucion_produccion_produccion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (produccion_id) REFERENCES produccion(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""distribucion_produccion"",
            ""nombre"": ""distribucion_produccion_sede_fkey"",
            ""definicion"": ""FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""distribucion_produccion"",
            ""nombre"": ""distribucion_produccion_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""inventario"",
            ""nombre"": ""inventario_cantidad_disponible_check"",
            ""definicion"": ""CHECK ((cantidad_disponible >= 0))""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""inventario"",
            ""nombre"": ""inventario_cantidad_reservada_check"",
            ""definicion"": ""CHECK ((cantidad_reservada >= 0))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""inventario"",
            ""nombre"": ""inventario_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""inventario"",
            ""nombre"": ""inventario_presentacion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""inventario"",
            ""nombre"": ""inventario_presentacion_id_sede_key"",
            ""definicion"": ""UNIQUE (presentacion_id, sede)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""inventario"",
            ""nombre"": ""inventario_sede_fkey"",
            ""definicion"": ""FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_detalle"",
            ""nombre"": ""lotes_detalle_cantidad_fabricada_check"",
            ""definicion"": ""CHECK ((cantidad_fabricada > 0))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_detalle"",
            ""nombre"": ""lotes_detalle_lote_id_fkey"",
            ""definicion"": ""FOREIGN KEY (lote_id) REFERENCES lotes_produccion(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""lotes_detalle"",
            ""nombre"": ""lotes_detalle_lote_id_presentacion_id_key"",
            ""definicion"": ""UNIQUE (lote_id, presentacion_id)""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""lotes_detalle"",
            ""nombre"": ""lotes_detalle_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_detalle"",
            ""nombre"": ""lotes_detalle_presentacion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_gastos"",
            ""nombre"": ""lotes_gastos_lote_id_fkey"",
            ""definicion"": ""FOREIGN KEY (lote_id) REFERENCES lotes_produccion(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_gastos"",
            ""nombre"": ""lotes_gastos_monto_check"",
            ""definicion"": ""CHECK ((monto >= (0)::numeric))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""lotes_gastos"",
            ""nombre"": ""lotes_gastos_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_gastos"",
            ""nombre"": ""lotes_gastos_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_cantidad_disponible_check"",
            ""definicion"": ""CHECK ((cantidad_disponible >= 0))""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_cantidad_inicial_check"",
            ""definicion"": ""CHECK ((cantidad_inicial >= 0))""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_cantidad_reservada_check"",
            ""definicion"": ""CHECK ((cantidad_reservada >= 0))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_lote_id_fkey"",
            ""definicion"": ""FOREIGN KEY (lote_id) REFERENCES lotes_produccion(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_lote_id_presentacion_id_sede_key"",
            ""definicion"": ""UNIQUE (lote_id, presentacion_id, sede)""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_presentacion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_inventario"",
            ""nombre"": ""lotes_inventario_sede_fkey"",
            ""definicion"": ""FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_produccion"",
            ""nombre"": ""lotes_produccion_aroma_id_fkey"",
            ""definicion"": ""FOREIGN KEY (aroma_id) REFERENCES aromas(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""lotes_produccion"",
            ""nombre"": ""lotes_produccion_numero_lote_key"",
            ""definicion"": ""UNIQUE (numero_lote)""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""lotes_produccion"",
            ""nombre"": ""lotes_produccion_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_produccion"",
            ""nombre"": ""lotes_produccion_producto_id_fkey"",
            ""definicion"": ""FOREIGN KEY (producto_id) REFERENCES productos(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_produccion"",
            ""nombre"": ""lotes_produccion_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_cantidad_check"",
            ""definicion"": ""CHECK ((cantidad > 0))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_detalle_venta_id_fkey"",
            ""definicion"": ""FOREIGN KEY (detalle_venta_id) REFERENCES detalles_venta(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_detalle_venta_id_lote_inventario_id_key"",
            ""definicion"": ""UNIQUE (detalle_venta_id, lote_inventario_id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_estado_check"",
            ""definicion"": ""CHECK ((estado = ANY (ARRAY['RESERVADA'::text, 'VENDIDA'::text, 'CANCELADA'::text])))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_lote_inventario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (lote_inventario_id) REFERENCES lotes_inventario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""lotes_ventas"",
            ""nombre"": ""lotes_ventas_venta_id_fkey"",
            ""definicion"": ""FOREIGN KEY (venta_id) REFERENCES ventas(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""movimientos_inventario"",
            ""nombre"": ""movimientos_inventario_cantidad_check"",
            ""definicion"": ""CHECK ((cantidad > 0))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""movimientos_inventario"",
            ""nombre"": ""movimientos_inventario_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""movimientos_inventario"",
            ""nombre"": ""movimientos_inventario_presentacion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""movimientos_inventario"",
            ""nombre"": ""movimientos_inventario_sede_fkey"",
            ""definicion"": ""FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""movimientos_inventario"",
            ""nombre"": ""movimientos_inventario_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""nombre"": ""operaciones_sincronizadas_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""nombre"": ""operaciones_sincronizadas_tipo_check"",
            ""definicion"": ""CHECK ((tipo_operacion = ANY (ARRAY['CREAR_VENTA'::text, 'RESERVAR_PEDIDO'::text, 'ENTREGAR_PEDIDO'::text, 'CANCELAR_PEDIDO'::text, 'SINCRONIZAR_CATALOGO'::text])))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""nombre"": ""operaciones_sincronizadas_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES auth.users(id)""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""nombre"": ""operaciones_sincronizadas_usuario_operacion_unique"",
            ""definicion"": ""UNIQUE (usuario_id, id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""pagos_venta"",
            ""nombre"": ""pagos_venta_monto_check"",
            ""definicion"": ""CHECK ((monto > (0)::numeric))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""pagos_venta"",
            ""nombre"": ""pagos_venta_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""pagos_venta"",
            ""nombre"": ""pagos_venta_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""pagos_venta"",
            ""nombre"": ""pagos_venta_venta_id_fkey"",
            ""definicion"": ""FOREIGN KEY (venta_id) REFERENCES ventas(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""perfiles_usuario"",
            ""nombre"": ""perfiles_usuario_correo_key"",
            ""definicion"": ""UNIQUE (correo)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""perfiles_usuario"",
            ""nombre"": ""perfiles_usuario_creado_por_fkey"",
            ""definicion"": ""FOREIGN KEY (creado_por) REFERENCES perfiles_usuario(id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""perfiles_usuario"",
            ""nombre"": ""perfiles_usuario_estado_check"",
            ""definicion"": ""CHECK ((estado = ANY (ARRAY['activo'::text, 'bloqueado'::text, 'desactivado'::text])))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""perfiles_usuario"",
            ""nombre"": ""perfiles_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (id) REFERENCES auth.users(id) ON DELETE CASCADE""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""perfiles_usuario"",
            ""nombre"": ""perfiles_usuario_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""perfiles_usuario"",
            ""nombre"": ""perfiles_usuario_rol_check"",
            ""definicion"": ""CHECK ((rol = ANY (ARRAY['administrador_principal'::text, 'administrador_secundario'::text, 'vendedor'::text])))""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""nombre"": ""modulo_valido"",
            ""definicion"": ""CHECK ((modulo = ANY (ARRAY['Inicio'::text, 'Ventas'::text, 'Productos'::text, 'Clientes'::text, 'Reportes'::text, 'Producción'::text, 'Inventario'::text, 'Lotes'::text])))""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""nombre"": ""permiso_modulo_unico"",
            ""definicion"": ""UNIQUE (usuario_id, modulo)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""nombre"": ""permisos_modulos_usuario_asignado_por_fkey"",
            ""definicion"": ""FOREIGN KEY (asignado_por) REFERENCES perfiles_usuario(id) ON DELETE SET NULL""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""nombre"": ""permisos_modulos_usuario_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""nombre"": ""permisos_modulos_usuario_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE CASCADE""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""permisos_usuario"",
            ""nombre"": ""permisos_usuario_asignado_por_fkey"",
            ""definicion"": ""FOREIGN KEY (asignado_por) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""permisos_usuario"",
            ""nombre"": ""permisos_usuario_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""permisos_usuario"",
            ""nombre"": ""permisos_usuario_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""UNIQUE"",
            ""tabla"": ""permisos_usuario"",
            ""nombre"": ""permisos_usuario_usuario_id_modulo_accion_key"",
            ""definicion"": ""UNIQUE (usuario_id, modulo, accion)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""presentaciones"",
            ""nombre"": ""presentaciones_aroma_id_fkey"",
            ""definicion"": ""FOREIGN KEY (aroma_id) REFERENCES aromas(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""presentaciones"",
            ""nombre"": ""presentaciones_contenido_ml_check"",
            ""definicion"": ""CHECK ((contenido_ml > 0))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""presentaciones"",
            ""nombre"": ""presentaciones_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""presentaciones"",
            ""nombre"": ""presentaciones_precio_check"",
            ""definicion"": ""CHECK ((precio >= (0)::numeric))""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""produccion"",
            ""nombre"": ""produccion_cantidad_producida_check"",
            ""definicion"": ""CHECK ((cantidad_producida > 0))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""produccion"",
            ""nombre"": ""produccion_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""produccion"",
            ""nombre"": ""produccion_presentacion_id_fkey"",
            ""definicion"": ""FOREIGN KEY (presentacion_id) REFERENCES presentaciones(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""produccion"",
            ""nombre"": ""produccion_usuario_id_fkey"",
            ""definicion"": ""FOREIGN KEY (usuario_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""productos"",
            ""nombre"": ""productos_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""sedes"",
            ""nombre"": ""sedes_codigo_valido"",
            ""definicion"": ""CHECK ((codigo = ANY (ARRAY['barrancas'::text, 'valledupar'::text])))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""sedes"",
            ""nombre"": ""sedes_pkey"",
            ""definicion"": ""PRIMARY KEY (codigo)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""ventas"",
            ""nombre"": ""ventas_cliente_id_fkey"",
            ""definicion"": ""FOREIGN KEY (cliente_id) REFERENCES clientes(id) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""ventas"",
            ""nombre"": ""ventas_descuento_check"",
            ""definicion"": ""CHECK ((descuento >= (0)::numeric))""
        },
        {
            ""tipo"": ""PRIMARY KEY"",
            ""tabla"": ""ventas"",
            ""nombre"": ""ventas_pkey"",
            ""definicion"": ""PRIMARY KEY (id)""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""ventas"",
            ""nombre"": ""ventas_sede_fkey"",
            ""definicion"": ""FOREIGN KEY (sede) REFERENCES sedes(codigo) ON DELETE RESTRICT""
        },
        {
            ""tipo"": ""CHECK"",
            ""tabla"": ""ventas"",
            ""nombre"": ""ventas_total_check"",
            ""definicion"": ""CHECK ((total >= (0)::numeric))""
        },
        {
            ""tipo"": ""FOREIGN KEY"",
            ""tabla"": ""ventas"",
            ""nombre"": ""ventas_vendedor_id_fkey"",
            ""definicion"": ""FOREIGN KEY (vendedor_id) REFERENCES perfiles_usuario(id) ON DELETE RESTRICT""
        }
    ],
    ""TABLAS_Y_COLUMNAS"": [
        {
            ""tipo"": ""text"",
            ""tabla"": ""aromas"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""aromas"",
            ""columna"": ""producto_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""aromas"",
            ""columna"": ""nombre"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""aromas"",
            ""columna"": ""activo"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""aromas"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""auditoria_admin"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": ""gen_random_uuid()""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""auditoria_admin"",
            ""columna"": ""administrador_id"",
            ""posicion"": 2,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""auditoria_admin"",
            ""columna"": ""usuario_afectado_id"",
            ""posicion"": 3,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""auditoria_admin"",
            ""columna"": ""accion"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""jsonb"",
            ""tabla"": ""auditoria_admin"",
            ""columna"": ""detalles"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""jsonb"",
            ""valor_default"": ""'{}'::jsonb""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""auditoria_admin"",
            ""columna"": ""fecha"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""bigint"",
            ""tabla"": ""cambios_sincronizacion"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int8"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""cambios_sincronizacion"",
            ""columna"": ""entidad"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""cambios_sincronizacion"",
            ""columna"": ""entidad_id"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""cambios_sincronizacion"",
            ""columna"": ""operacion"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""cambios_sincronizacion"",
            ""columna"": ""fecha_cambio"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""clientes"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""clientes"",
            ""columna"": ""nombre"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""clientes"",
            ""columna"": ""telefono"",
            ""posicion"": 3,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""clientes"",
            ""columna"": ""direccion"",
            ""posicion"": 4,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""clientes"",
            ""columna"": ""observaciones"",
            ""posicion"": 5,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""clientes"",
            ""columna"": ""activo"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""clientes"",
            ""columna"": ""usuario_creador_id"",
            ""posicion"": 7,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""clientes"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 8,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""configuracion_sistema"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""configuracion_sistema"",
            ""columna"": ""administrador_principal_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""configuracion_sistema"",
            ""columna"": ""fecha_configuracion"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""control_numeracion_lotes"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""bigint"",
            ""tabla"": ""control_numeracion_lotes"",
            ""columna"": ""ultimo_numero"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int8"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""detalles_venta"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""detalles_venta"",
            ""columna"": ""venta_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""detalles_venta"",
            ""columna"": ""presentacion_id"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""detalles_venta"",
            ""columna"": ""cantidad"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""detalles_venta"",
            ""columna"": ""precio_unitario"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""detalles_venta"",
            ""columna"": ""subtotal"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""distribucion_produccion"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""distribucion_produccion"",
            ""columna"": ""produccion_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""distribucion_produccion"",
            ""columna"": ""sede"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""distribucion_produccion"",
            ""columna"": ""cantidad"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""distribucion_produccion"",
            ""columna"": ""usuario_id"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""distribucion_produccion"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""inventario"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""inventario"",
            ""columna"": ""presentacion_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""inventario"",
            ""columna"": ""sede"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""inventario"",
            ""columna"": ""cantidad_disponible"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""inventario"",
            ""columna"": ""cantidad_reservada"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""inventario"",
            ""columna"": ""fecha_actualizacion"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_detalle"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_detalle"",
            ""columna"": ""lote_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_detalle"",
            ""columna"": ""presentacion_id"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""lotes_detalle"",
            ""columna"": ""cantidad_fabricada"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""lote_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""concepto"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""monto"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""observacion"",
            ""posicion"": 5,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""usuario_id"",
            ""posicion"": 6,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""lotes_gastos"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""lote_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""presentacion_id"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""sede"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""cantidad_disponible"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""cantidad_reservada"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""lotes_inventario"",
            ""columna"": ""cantidad_inicial"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_produccion"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_produccion"",
            ""columna"": ""producto_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_produccion"",
            ""columna"": ""aroma_id"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_produccion"",
            ""columna"": ""numero_lote"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""lotes_produccion"",
            ""columna"": ""usuario_id"",
            ""posicion"": 5,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""lotes_produccion"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_ventas"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_ventas"",
            ""columna"": ""venta_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_ventas"",
            ""columna"": ""detalle_venta_id"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_ventas"",
            ""columna"": ""lote_inventario_id"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""lotes_ventas"",
            ""columna"": ""cantidad"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""lotes_ventas"",
            ""columna"": ""estado"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""presentacion_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""sede"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""tipo_movimiento"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""cantidad"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""referencia_id"",
            ""posicion"": 6,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""observacion"",
            ""posicion"": 7,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""usuario_id"",
            ""posicion"": 8,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""movimientos_inventario"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 9,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""columna"": ""usuario_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""columna"": ""tipo_operacion"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""columna"": ""entidad"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""columna"": ""entidad_id"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""operaciones_sincronizadas"",
            ""columna"": ""fecha_procesamiento"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""venta_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""monto"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""metodo_pago"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""observacion"",
            ""posicion"": 5,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""usuario_id"",
            ""posicion"": 6,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""pagos_venta"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""nombre_completo"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""correo"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""rol"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""estado"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": ""'activo'::text""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""creado_por"",
            ""posicion"": 6,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""fecha_actualizacion"",
            ""posicion"": 8,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""nombre_usuario"",
            ""posicion"": 9,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""foto_perfil_path"",
            ""posicion"": 10,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""perfiles_usuario"",
            ""columna"": ""debe_cambiar_contrasena"",
            ""posicion"": 11,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""false""
        },
        {
            ""tipo"": ""bigint"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int8"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""columna"": ""usuario_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""columna"": ""modulo"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""columna"": ""asignado_por"",
            ""posicion"": 4,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""permisos_modulos_usuario"",
            ""columna"": ""fecha_asignacion"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": ""gen_random_uuid()""
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""usuario_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""modulo"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""accion"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""asignado_por"",
            ""posicion"": 5,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""fecha_asignacion"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""permisos_usuario"",
            ""columna"": ""habilitado"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""aroma_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""nombre"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""contenido_ml"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""precio"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""foto_storage_path"",
            ""posicion"": 6,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""activo"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""presentaciones"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 8,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""produccion"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""produccion"",
            ""columna"": ""presentacion_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""integer"",
            ""tabla"": ""produccion"",
            ""columna"": ""cantidad_producida"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""int4"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""produccion"",
            ""columna"": ""usuario_id"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""produccion"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""productos"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""productos"",
            ""columna"": ""nombre"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""productos"",
            ""columna"": ""tipo"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": ""'Desinfectante'::text""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""productos"",
            ""columna"": ""foto_storage_path"",
            ""posicion"": 4,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""productos"",
            ""columna"": ""activo"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""productos"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""sedes"",
            ""columna"": ""codigo"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""sedes"",
            ""columna"": ""nombre"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""boolean"",
            ""tabla"": ""sedes"",
            ""columna"": ""activo"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""bool"",
            ""valor_default"": ""true""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""sedes"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 4,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""ventas"",
            ""columna"": ""id"",
            ""posicion"": 1,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""ventas"",
            ""columna"": ""cliente_id"",
            ""posicion"": 2,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""ventas"",
            ""columna"": ""sede"",
            ""posicion"": 3,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""uuid"",
            ""tabla"": ""ventas"",
            ""columna"": ""vendedor_id"",
            ""posicion"": 4,
            ""permite_null"": ""YES"",
            ""tipo_completo"": ""uuid"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""ventas"",
            ""columna"": ""vendedor_nombre"",
            ""posicion"": 5,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": ""'Sin atribuir'::text""
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""ventas"",
            ""columna"": ""tipo_venta"",
            ""posicion"": 6,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""text"",
            ""tabla"": ""ventas"",
            ""columna"": ""estado_entrega"",
            ""posicion"": 7,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""text"",
            ""valor_default"": null
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""ventas"",
            ""columna"": ""total"",
            ""posicion"": 8,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""numeric"",
            ""tabla"": ""ventas"",
            ""columna"": ""descuento"",
            ""posicion"": 9,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""numeric"",
            ""valor_default"": ""0""
        },
        {
            ""tipo"": ""timestamp with time zone"",
            ""tabla"": ""ventas"",
            ""columna"": ""fecha_creacion"",
            ""posicion"": 10,
            ""permite_null"": ""NO"",
            ""tipo_completo"": ""timestamptz"",
            ""valor_default"": ""now()""
        }
    ]
}"

104,059 chars · codepastes.com