--
-- PostgreSQL database dump
--
CREATE USER docker superuser login password 'docker';

CREATE DATABASE docker;
GRANT ALL PRIVILEGES ON DATABASE docker TO docker;

-- Dumped from database version 14.6 (Debian 14.6-1.pgdg110+1)
-- Dumped by pg_dump version 14.6 (Ubuntu 14.6-0ubuntu0.22.04.1)

SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET xmloption = content;
SET client_min_messages = warning;
SET row_security = off;

--
-- Name: registros; Type: SCHEMA; Schema: -; Owner: -
--

CREATE SCHEMA registros;


--
-- Name: usuarios; Type: SCHEMA; Schema: -; Owner: -
--

CREATE SCHEMA usuarios;


SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: conexiones; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.conexiones (
    id bigint NOT NULL,
    ipaddrid integer NOT NULL,
    sesionid integer NOT NULL,
    iniciada timestamp with time zone DEFAULT now(),
    ultimo timestamp with time zone
);


--
-- Name: conexiones_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.conexiones_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: conexiones_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.conexiones_id_seq OWNED BY registros.conexiones.id;


--
-- Name: dispositivos; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.dispositivos (
    id integer NOT NULL,
    useragent character varying(1024) NOT NULL,
    parsed_ua character varying(150),
    dev character varying(50),
    os character varying(50),
    browser character varying(50)
);


--
-- Name: dispositivos_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.dispositivos_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: dispositivos_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.dispositivos_id_seq OWNED BY registros.dispositivos.id;


--
-- Name: ipaddrs; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.ipaddrs (
    id integer NOT NULL,
    ipaddr inet NOT NULL,
    hostname character varying(100)
);


--
-- Name: ipaddrs_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.ipaddrs_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: ipaddrs_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.ipaddrs_id_seq OWNED BY registros.ipaddrs.id;


--
-- Name: registros; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.registros (
    id bigint NOT NULL,
    sitioid integer NOT NULL,
    rutaid integer NOT NULL,
    sesionid bigint NOT NULL,
    ipaddrid integer NOT NULL,
    tamano integer,
    creado timestamp without time zone DEFAULT now()
);


--
-- Name: registros_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.registros_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: registros_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.registros_id_seq OWNED BY registros.registros.id;


--
-- Name: rutas; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.rutas (
    id integer NOT NULL,
    ruta character varying(100) NOT NULL
);


--
-- Name: rutas_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.rutas_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: rutas_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.rutas_id_seq OWNED BY registros.rutas.id;


--
-- Name: sesiones; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.sesiones (
    id bigint NOT NULL,
    identidadid bigint NOT NULL,
    dispositivoid integer NOT NULL,
    iniciada timestamp with time zone DEFAULT now(),
    ultimo timestamp with time zone
);


--
-- Name: sesiones_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.sesiones_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: sesiones_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.sesiones_id_seq OWNED BY registros.sesiones.id;


--
-- Name: sitios; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.sitios (
    id integer NOT NULL,
    sitio character varying(100) NOT NULL
);


--
-- Name: sitios_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.sitios_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: sitios_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.sitios_id_seq OWNED BY registros.sitios.id;


--
-- Name: ubicaciones; Type: TABLE; Schema: registros; Owner: -
--

CREATE TABLE registros.ubicaciones (
    id bigint NOT NULL,
    ipaddrid integer NOT NULL,
    identidadid integer NOT NULL,
    descripcion character varying(200),
    iniciada timestamp with time zone DEFAULT now(),
    ultimo timestamp with time zone
);


--
-- Name: ubicaciones_id_seq; Type: SEQUENCE; Schema: registros; Owner: -
--

CREATE SEQUENCE registros.ubicaciones_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: ubicaciones_id_seq; Type: SEQUENCE OWNED BY; Schema: registros; Owner: -
--

ALTER SEQUENCE registros.ubicaciones_id_seq OWNED BY registros.ubicaciones.id;


--
-- Name: correos; Type: TABLE; Schema: usuarios; Owner: -
--

CREATE TABLE usuarios.correos (
    id integer NOT NULL,
    correo character varying(100) NOT NULL,
    cuentaid bigint NOT NULL,
    "default" boolean
);


--
-- Name: correos_id_seq; Type: SEQUENCE; Schema: usuarios; Owner: -
--

CREATE SEQUENCE usuarios.correos_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: correos_id_seq; Type: SEQUENCE OWNED BY; Schema: usuarios; Owner: -
--

ALTER SEQUENCE usuarios.correos_id_seq OWNED BY usuarios.correos.id;


--
-- Name: cuentas; Type: TABLE; Schema: usuarios; Owner: -
--

CREATE TABLE usuarios.cuentas (
    id bigint NOT NULL,
    clave character varying(60) NOT NULL,
    sysadmin boolean,
    ultimoacceso timestamp with time zone
);


--
-- Name: identidades; Type: TABLE; Schema: usuarios; Owner: -
--

CREATE TABLE usuarios.identidades (
    id bigint NOT NULL,
    login character varying(50) NOT NULL,
    alias character varying(50),
    creado timestamp with time zone DEFAULT now(),
    modificado timestamp with time zone,
    tipo character varying(20)
);


--
-- Name: identidades_id_seq; Type: SEQUENCE; Schema: usuarios; Owner: -
--

CREATE SEQUENCE usuarios.identidades_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: identidades_id_seq; Type: SEQUENCE OWNED BY; Schema: usuarios; Owner: -
--

ALTER SEQUENCE usuarios.identidades_id_seq OWNED BY usuarios.identidades.id;


--
-- Name: personas; Type: TABLE; Schema: usuarios; Owner: -
--

CREATE TABLE usuarios.personas (
    id bigint NOT NULL,
    nombres character varying(100) NOT NULL,
    apellidop character varying(100) NOT NULL,
    apellidom character varying(100),
    rut character varying(20) NOT NULL,
    telefono character varying(20),
    foto character varying(50) NOT NULL
);


--
-- Name: conexiones id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.conexiones ALTER COLUMN id SET DEFAULT nextval('registros.conexiones_id_seq'::regclass);


--
-- Name: dispositivos id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.dispositivos ALTER COLUMN id SET DEFAULT nextval('registros.dispositivos_id_seq'::regclass);


--
-- Name: ipaddrs id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ipaddrs ALTER COLUMN id SET DEFAULT nextval('registros.ipaddrs_id_seq'::regclass);


--
-- Name: registros id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.registros ALTER COLUMN id SET DEFAULT nextval('registros.registros_id_seq'::regclass);


--
-- Name: rutas id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.rutas ALTER COLUMN id SET DEFAULT nextval('registros.rutas_id_seq'::regclass);


--
-- Name: sesiones id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sesiones ALTER COLUMN id SET DEFAULT nextval('registros.sesiones_id_seq'::regclass);


--
-- Name: sitios id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sitios ALTER COLUMN id SET DEFAULT nextval('registros.sitios_id_seq'::regclass);


--
-- Name: ubicaciones id; Type: DEFAULT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ubicaciones ALTER COLUMN id SET DEFAULT nextval('registros.ubicaciones_id_seq'::regclass);


--
-- Name: correos id; Type: DEFAULT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.correos ALTER COLUMN id SET DEFAULT nextval('usuarios.correos_id_seq'::regclass);


--
-- Name: identidades id; Type: DEFAULT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.identidades ALTER COLUMN id SET DEFAULT nextval('usuarios.identidades_id_seq'::regclass);


--
-- Data for Name: conexiones; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.conexiones (id, ipaddrid, sesionid, iniciada, ultimo) FROM stdin;
1	1	1	2023-02-27 01:18:31.243924+00	2023-02-27 01:18:31.24764+00
\.


--
-- Data for Name: dispositivos; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.dispositivos (id, useragent, parsed_ua, dev, os, browser) FROM stdin;
1	Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/110.0	PC / Linux / Firefox 110.0	PC	Linux	Firefox 110.0
\.


--
-- Data for Name: ipaddrs; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.ipaddrs (id, ipaddr, hostname) FROM stdin;
1	172.23.0.1	\N
\.


--
-- Data for Name: registros; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.registros (id, sitioid, rutaid, sesionid, ipaddrid, tamano, creado) FROM stdin;
1	1	1	1	1	0	2023-02-27 01:18:31.248091
\.


--
-- Data for Name: rutas; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.rutas (id, ruta) FROM stdin;
1	/favicon.ico
\.


--
-- Data for Name: sesiones; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.sesiones (id, identidadid, dispositivoid, iniciada, ultimo) FROM stdin;
1	2	1	2023-02-27 01:18:31.241528+00	2023-02-27 01:18:31.24764+00
\.


--
-- Data for Name: sitios; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.sitios (id, sitio) FROM stdin;
1	localhost:5003
\.


--
-- Data for Name: ubicaciones; Type: TABLE DATA; Schema: registros; Owner: -
--

COPY registros.ubicaciones (id, ipaddrid, identidadid, descripcion, iniciada, ultimo) FROM stdin;
\.


--
-- Data for Name: correos; Type: TABLE DATA; Schema: usuarios; Owner: -
--

COPY usuarios.correos (id, correo, cuentaid, "default") FROM stdin;
\.


--
-- Data for Name: cuentas; Type: TABLE DATA; Schema: usuarios; Owner: -
--

COPY usuarios.cuentas (id, clave, sysadmin, ultimoacceso) FROM stdin;
4	$2b$12$Xa.mKurU3IVc54Pirzs9ReAjI4AivIFu/EGUelx59/xorVN1Jkb5i	f	\N
5	$2b$12$2f6Zjld4.4lMz77r9gncNe4O2nDNVs1lV0CkpbRDOW3b8876h3wyC	f	\N
\.


--
-- Data for Name: identidades; Type: TABLE DATA; Schema: usuarios; Owner: -
--

COPY usuarios.identidades (id, login, alias, creado, modificado, tipo) FROM stdin;
1	Internet	\N	2023-02-27 01:18:31.225317+00	\N	Identidad
2	Intranet	\N	2023-02-27 01:18:31.225317+00	\N	Identidad
3	Buscador	\N	2023-02-27 01:18:31.225317+00	\N	Identidad
4	ifiguero	\N	2023-02-27 01:18:31.225317+00	\N	Persona
5	tpmc	\N	2023-02-27 01:18:31.225317+00	\N	Persona
\.


--
-- Data for Name: personas; Type: TABLE DATA; Schema: usuarios; Owner: -
--

COPY usuarios.personas (id, nombres, apellidop, apellidom, rut, telefono, foto) FROM stdin;
4	Israel	Figueroa	\N	13955977-0	\N	default.jpg
5	Transporte	Público	\N	tpmc	\N	default.jpg
\.


--
-- Name: conexiones_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.conexiones_id_seq', 1, true);


--
-- Name: dispositivos_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.dispositivos_id_seq', 1, true);


--
-- Name: ipaddrs_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.ipaddrs_id_seq', 1, true);


--
-- Name: registros_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.registros_id_seq', 1, true);


--
-- Name: rutas_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.rutas_id_seq', 1, true);


--
-- Name: sesiones_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.sesiones_id_seq', 1, true);


--
-- Name: sitios_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.sitios_id_seq', 1, true);


--
-- Name: ubicaciones_id_seq; Type: SEQUENCE SET; Schema: registros; Owner: -
--

SELECT pg_catalog.setval('registros.ubicaciones_id_seq', 1, false);


--
-- Name: correos_id_seq; Type: SEQUENCE SET; Schema: usuarios; Owner: -
--

SELECT pg_catalog.setval('usuarios.correos_id_seq', 1, false);


--
-- Name: identidades_id_seq; Type: SEQUENCE SET; Schema: usuarios; Owner: -
--

SELECT pg_catalog.setval('usuarios.identidades_id_seq', 5, true);


--
-- Name: ubicaciones _una_ip_identidad_uc; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ubicaciones
    ADD CONSTRAINT _una_ip_identidad_uc UNIQUE (ipaddrid, identidadid);


--
-- Name: conexiones _una_ip_sesion_uc; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.conexiones
    ADD CONSTRAINT _una_ip_sesion_uc UNIQUE (ipaddrid, sesionid);


--
-- Name: conexiones conexiones_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.conexiones
    ADD CONSTRAINT conexiones_pkey PRIMARY KEY (id);


--
-- Name: dispositivos dispositivos_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.dispositivos
    ADD CONSTRAINT dispositivos_pkey PRIMARY KEY (id);


--
-- Name: dispositivos dispositivos_useragent_key; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.dispositivos
    ADD CONSTRAINT dispositivos_useragent_key UNIQUE (useragent);


--
-- Name: ipaddrs ipaddrs_ipaddr_key; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ipaddrs
    ADD CONSTRAINT ipaddrs_ipaddr_key UNIQUE (ipaddr);


--
-- Name: ipaddrs ipaddrs_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ipaddrs
    ADD CONSTRAINT ipaddrs_pkey PRIMARY KEY (id);


--
-- Name: registros registros_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.registros
    ADD CONSTRAINT registros_pkey PRIMARY KEY (id);


--
-- Name: rutas rutas_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.rutas
    ADD CONSTRAINT rutas_pkey PRIMARY KEY (id);


--
-- Name: rutas rutas_ruta_key; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.rutas
    ADD CONSTRAINT rutas_ruta_key UNIQUE (ruta);


--
-- Name: sesiones sesiones_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sesiones
    ADD CONSTRAINT sesiones_pkey PRIMARY KEY (id);


--
-- Name: sitios sitios_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sitios
    ADD CONSTRAINT sitios_pkey PRIMARY KEY (id);


--
-- Name: sitios sitios_sitio_key; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sitios
    ADD CONSTRAINT sitios_sitio_key UNIQUE (sitio);


--
-- Name: ubicaciones ubicaciones_pkey; Type: CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ubicaciones
    ADD CONSTRAINT ubicaciones_pkey PRIMARY KEY (id);


--
-- Name: correos correos_correo_key; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.correos
    ADD CONSTRAINT correos_correo_key UNIQUE (correo);


--
-- Name: correos correos_pkey; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.correos
    ADD CONSTRAINT correos_pkey PRIMARY KEY (id);


--
-- Name: cuentas cuentas_pkey; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.cuentas
    ADD CONSTRAINT cuentas_pkey PRIMARY KEY (id);


--
-- Name: identidades identidades_login_key; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.identidades
    ADD CONSTRAINT identidades_login_key UNIQUE (login);


--
-- Name: identidades identidades_pkey; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.identidades
    ADD CONSTRAINT identidades_pkey PRIMARY KEY (id);


--
-- Name: personas personas_pkey; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.personas
    ADD CONSTRAINT personas_pkey PRIMARY KEY (id);


--
-- Name: personas personas_rut_key; Type: CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.personas
    ADD CONSTRAINT personas_rut_key UNIQUE (rut);


--
-- Name: conexiones conexiones_ipaddrid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.conexiones
    ADD CONSTRAINT conexiones_ipaddrid_fkey FOREIGN KEY (ipaddrid) REFERENCES registros.ipaddrs(id);


--
-- Name: conexiones conexiones_sesionid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.conexiones
    ADD CONSTRAINT conexiones_sesionid_fkey FOREIGN KEY (sesionid) REFERENCES registros.sesiones(id);


--
-- Name: registros registros_ipaddrid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.registros
    ADD CONSTRAINT registros_ipaddrid_fkey FOREIGN KEY (ipaddrid) REFERENCES registros.ipaddrs(id);


--
-- Name: registros registros_rutaid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.registros
    ADD CONSTRAINT registros_rutaid_fkey FOREIGN KEY (rutaid) REFERENCES registros.rutas(id);


--
-- Name: registros registros_sesionid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.registros
    ADD CONSTRAINT registros_sesionid_fkey FOREIGN KEY (sesionid) REFERENCES registros.sesiones(id);


--
-- Name: registros registros_sitioid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.registros
    ADD CONSTRAINT registros_sitioid_fkey FOREIGN KEY (sitioid) REFERENCES registros.sitios(id);


--
-- Name: sesiones sesiones_dispositivoid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sesiones
    ADD CONSTRAINT sesiones_dispositivoid_fkey FOREIGN KEY (dispositivoid) REFERENCES registros.dispositivos(id);


--
-- Name: sesiones sesiones_identidadid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.sesiones
    ADD CONSTRAINT sesiones_identidadid_fkey FOREIGN KEY (identidadid) REFERENCES usuarios.identidades(id);


--
-- Name: ubicaciones ubicaciones_identidadid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ubicaciones
    ADD CONSTRAINT ubicaciones_identidadid_fkey FOREIGN KEY (identidadid) REFERENCES usuarios.identidades(id);


--
-- Name: ubicaciones ubicaciones_ipaddrid_fkey; Type: FK CONSTRAINT; Schema: registros; Owner: -
--

ALTER TABLE ONLY registros.ubicaciones
    ADD CONSTRAINT ubicaciones_ipaddrid_fkey FOREIGN KEY (ipaddrid) REFERENCES registros.ipaddrs(id);


--
-- Name: correos correos_cuentaid_fkey; Type: FK CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.correos
    ADD CONSTRAINT correos_cuentaid_fkey FOREIGN KEY (cuentaid) REFERENCES usuarios.cuentas(id);


--
-- Name: cuentas cuentas_id_fkey; Type: FK CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.cuentas
    ADD CONSTRAINT cuentas_id_fkey FOREIGN KEY (id) REFERENCES usuarios.identidades(id);


--
-- Name: personas personas_id_fkey; Type: FK CONSTRAINT; Schema: usuarios; Owner: -
--

ALTER TABLE ONLY usuarios.personas
    ADD CONSTRAINT personas_id_fkey FOREIGN KEY (id) REFERENCES usuarios.cuentas(id);


--
-- PostgreSQL database dump complete
--
