--
-- PostgreSQL database dump
--

\restrict f5OrNGsqq3lXZfASjfZClhWTE6J9ra0iNgidj8HHRi2NRehsEqLZedJHwwbqMgi

-- Dumped from database version 16.11 (Debian 16.11-1.pgdg13+1)
-- Dumped by pg_dump version 16.11 (Debian 16.11-1.pgdg13+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;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: categorias; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.categorias (
    id integer NOT NULL,
    nombre character varying(50) NOT NULL,
    porcentaje_ganancia numeric(5,2),
    descuento numeric(5,2)
);


--
-- Name: categorias_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.categorias_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: categorias_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.categorias_id_seq OWNED BY public.categorias.id;


--
-- Name: clientes; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.clientes (
    id integer NOT NULL,
    nombre character varying(50) NOT NULL,
    apellido character varying(50) NOT NULL,
    telefono character varying(25) NOT NULL,
    email character varying(100),
    cuit character varying(11),
    cond_iva character varying(30)
);


--
-- Name: clientes_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.clientes_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: clientes_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.clientes_id_seq OWNED BY public.clientes.id;


--
-- Name: configuracion; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.configuracion (
    id integer NOT NULL,
    nombre character varying(100) NOT NULL,
    direccion character varying(100) NOT NULL,
    ciudad character varying(100) NOT NULL,
    codigo_postal character varying(4) NOT NULL,
    provincia character varying(100) NOT NULL,
    telefono character varying(10) NOT NULL,
    email character varying(100) NOT NULL,
    cond_iva character varying(50) NOT NULL,
    cuit character varying(20) NOT NULL,
    inicio_act date NOT NULL,
    iva numeric(5,2) NOT NULL,
    hora_apertura_maniana time without time zone NOT NULL,
    hora_cierre_maniana time without time zone NOT NULL,
    hora_apertura_tarde time without time zone NOT NULL,
    hora_cierre_tarde time without time zone NOT NULL,
    cargo_cancelacion_servicio numeric(10,2) NOT NULL,
    mail_automatico boolean DEFAULT false,
    logo_ruta character varying(100) DEFAULT '/imgs/headerPDF.png'::character varying NOT NULL,
    email_emisor character varying(100),
    contrasenia_emisor character varying(250)
);


--
-- Name: pedido_detalle; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.pedido_detalle (
    id integer NOT NULL,
    precio_unitario numeric(10,2) NOT NULL,
    cantidad integer NOT NULL,
    subtotal integer NOT NULL,
    cantidad_vendida integer DEFAULT 0,
    id_pedido integer NOT NULL,
    id_producto integer NOT NULL
);


--
-- Name: pedido_detalle_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.pedido_detalle_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: pedido_detalle_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.pedido_detalle_id_seq OWNED BY public.pedido_detalle.id;


--
-- Name: pedidos; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.pedidos (
    id integer NOT NULL,
    fecha date DEFAULT CURRENT_DATE NOT NULL,
    total numeric(10,2),
    id_proveedor integer NOT NULL,
    id_usuario integer NOT NULL
);


--
-- Name: pedidos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.pedidos_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: pedidos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.pedidos_id_seq OWNED BY public.pedidos.id;


--
-- Name: productos; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.productos (
    id integer NOT NULL,
    marca character varying(50) NOT NULL,
    modelo character varying(50) NOT NULL,
    precio numeric(10,2),
    stock integer,
    descuento numeric(5,2),
    estado boolean NOT NULL,
    id_categoria integer NOT NULL,
    id_tipo integer NOT NULL
);


--
-- Name: productos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.productos_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: productos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.productos_id_seq OWNED BY public.productos.id;


--
-- Name: proveedores; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.proveedores (
    id integer NOT NULL,
    razon_social character varying(100) NOT NULL,
    telefono character varying(25) NOT NULL,
    email character varying(100),
    cuit character varying(11),
    cond_iva character varying(30)
);


--
-- Name: proveedores_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.proveedores_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: proveedores_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.proveedores_id_seq OWNED BY public.proveedores.id;


--
-- Name: recuperacion_cuenta; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.recuperacion_cuenta (
    id integer NOT NULL,
    id_usuario integer NOT NULL,
    codigo character varying(255) NOT NULL,
    expira_a timestamp without time zone NOT NULL,
    usado integer DEFAULT 0,
    creado_a timestamp without time zone DEFAULT CURRENT_TIMESTAMP
);


--
-- Name: recuperacion_cuenta_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.recuperacion_cuenta_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: recuperacion_cuenta_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.recuperacion_cuenta_id_seq OWNED BY public.recuperacion_cuenta.id;


--
-- Name: remito_preview_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.remito_preview_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: servicio_detalle; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.servicio_detalle (
    id integer NOT NULL,
    precio_unitario numeric(10,2) NOT NULL,
    cantidad integer NOT NULL,
    subtotal numeric(10,2) NOT NULL,
    id_servicio integer NOT NULL,
    id_producto integer NOT NULL,
    id_pedido integer NOT NULL
);


--
-- Name: servicio_detalle_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.servicio_detalle_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: servicio_detalle_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.servicio_detalle_id_seq OWNED BY public.servicio_detalle.id;


--
-- Name: servicio_preview_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.servicio_preview_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: servicios; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.servicios (
    id integer NOT NULL,
    fecha_registro date DEFAULT CURRENT_DATE NOT NULL,
    equipo character varying(100) NOT NULL,
    contrasenia_equipo text,
    problema character varying(2000) NOT NULL,
    observacion character varying(500),
    cuenta character varying(100),
    contrasenia_cuenta text,
    estado character varying(50) DEFAULT 'pendiente'::character varying NOT NULL,
    fecha_terminado date,
    detalle_realizado character varying(2000),
    mano_obra numeric(10,2),
    total numeric(10,2),
    id_cliente integer NOT NULL,
    id_usuario integer NOT NULL
);


--
-- Name: servicios_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.servicios_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: servicios_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.servicios_id_seq OWNED BY public.servicios.id;


--
-- Name: tipos; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.tipos (
    id integer NOT NULL,
    nombre character varying(50) NOT NULL
);


--
-- Name: tipos_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.tipos_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: tipos_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.tipos_id_seq OWNED BY public.tipos.id;


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

CREATE TABLE public.usuarios (
    id integer NOT NULL,
    nombre character varying(50) NOT NULL,
    apellido character varying(50) NOT NULL,
    usuario character varying(30) NOT NULL,
    password text NOT NULL,
    telefono character varying(25),
    email character varying(100) NOT NULL,
    rol character varying(20) DEFAULT 'operador'::character varying NOT NULL,
    activo boolean DEFAULT true
);


--
-- Name: usuarios_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.usuarios_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: usuarios_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.usuarios_id_seq OWNED BY public.usuarios.id;


--
-- Name: venta_detalle; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.venta_detalle (
    id integer NOT NULL,
    precio_unitario numeric(10,2) NOT NULL,
    cantidad integer NOT NULL,
    subtotal numeric(10,2) NOT NULL,
    descuento_pct numeric(5,2),
    id_venta integer NOT NULL,
    id_producto integer NOT NULL,
    id_pedido integer NOT NULL
);


--
-- Name: venta_detalle_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.venta_detalle_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: venta_detalle_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.venta_detalle_id_seq OWNED BY public.venta_detalle.id;


--
-- Name: venta_preview_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.venta_preview_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: ventas; Type: TABLE; Schema: public; Owner: -
--

CREATE TABLE public.ventas (
    id integer NOT NULL,
    fecha date DEFAULT CURRENT_DATE NOT NULL,
    total numeric(10,2) NOT NULL,
    forma_pago character varying(30) NOT NULL,
    tipo_pago character varying(15) NOT NULL,
    cant_cuotas integer,
    descuento_pct numeric(5,2),
    recargo_pct numeric(5,2),
    id_cliente integer NOT NULL,
    id_usuario integer NOT NULL
);


--
-- Name: ventas_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--

CREATE SEQUENCE public.ventas_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


--
-- Name: ventas_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--

ALTER SEQUENCE public.ventas_id_seq OWNED BY public.ventas.id;


--
-- Name: categorias id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.categorias ALTER COLUMN id SET DEFAULT nextval('public.categorias_id_seq'::regclass);


--
-- Name: clientes id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.clientes ALTER COLUMN id SET DEFAULT nextval('public.clientes_id_seq'::regclass);


--
-- Name: pedido_detalle id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedido_detalle ALTER COLUMN id SET DEFAULT nextval('public.pedido_detalle_id_seq'::regclass);


--
-- Name: pedidos id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedidos ALTER COLUMN id SET DEFAULT nextval('public.pedidos_id_seq'::regclass);


--
-- Name: productos id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.productos ALTER COLUMN id SET DEFAULT nextval('public.productos_id_seq'::regclass);


--
-- Name: proveedores id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.proveedores ALTER COLUMN id SET DEFAULT nextval('public.proveedores_id_seq'::regclass);


--
-- Name: recuperacion_cuenta id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.recuperacion_cuenta ALTER COLUMN id SET DEFAULT nextval('public.recuperacion_cuenta_id_seq'::regclass);


--
-- Name: servicio_detalle id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicio_detalle ALTER COLUMN id SET DEFAULT nextval('public.servicio_detalle_id_seq'::regclass);


--
-- Name: servicios id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicios ALTER COLUMN id SET DEFAULT nextval('public.servicios_id_seq'::regclass);


--
-- Name: tipos id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.tipos ALTER COLUMN id SET DEFAULT nextval('public.tipos_id_seq'::regclass);


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

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


--
-- Name: venta_detalle id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.venta_detalle ALTER COLUMN id SET DEFAULT nextval('public.venta_detalle_id_seq'::regclass);


--
-- Name: ventas id; Type: DEFAULT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.ventas ALTER COLUMN id SET DEFAULT nextval('public.ventas_id_seq'::regclass);


--
-- Name: categorias categorias_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.categorias
    ADD CONSTRAINT categorias_pkey PRIMARY KEY (id);


--
-- Name: clientes clientes_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.clientes
    ADD CONSTRAINT clientes_pkey PRIMARY KEY (id);


--
-- Name: configuracion configuracion_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.configuracion
    ADD CONSTRAINT configuracion_pkey PRIMARY KEY (id);


--
-- Name: pedido_detalle pedido_detalle_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedido_detalle
    ADD CONSTRAINT pedido_detalle_pkey PRIMARY KEY (id);


--
-- Name: pedidos pedidos_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedidos
    ADD CONSTRAINT pedidos_pkey PRIMARY KEY (id);


--
-- Name: productos productos_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.productos
    ADD CONSTRAINT productos_pkey PRIMARY KEY (id);


--
-- Name: proveedores proveedores_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.proveedores
    ADD CONSTRAINT proveedores_pkey PRIMARY KEY (id);


--
-- Name: recuperacion_cuenta recuperacion_cuenta_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.recuperacion_cuenta
    ADD CONSTRAINT recuperacion_cuenta_pkey PRIMARY KEY (id);


--
-- Name: servicio_detalle servicio_detalle_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicio_detalle
    ADD CONSTRAINT servicio_detalle_pkey PRIMARY KEY (id);


--
-- Name: servicios servicios_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicios
    ADD CONSTRAINT servicios_pkey PRIMARY KEY (id);


--
-- Name: tipos tipos_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.tipos
    ADD CONSTRAINT tipos_pkey PRIMARY KEY (id);


--
-- Name: usuarios usuarios_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.usuarios
    ADD CONSTRAINT usuarios_pkey PRIMARY KEY (id);


--
-- Name: usuarios usuarios_usuario_key; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.usuarios
    ADD CONSTRAINT usuarios_usuario_key UNIQUE (usuario);


--
-- Name: venta_detalle venta_detalle_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.venta_detalle
    ADD CONSTRAINT venta_detalle_pkey PRIMARY KEY (id);


--
-- Name: ventas ventas_pkey; Type: CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.ventas
    ADD CONSTRAINT ventas_pkey PRIMARY KEY (id);


--
-- Name: pedido_detalle fk_pedidodetalle_pedido; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedido_detalle
    ADD CONSTRAINT fk_pedidodetalle_pedido FOREIGN KEY (id_pedido) REFERENCES public.pedidos(id);


--
-- Name: pedido_detalle fk_pedidodetalle_producto; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedido_detalle
    ADD CONSTRAINT fk_pedidodetalle_producto FOREIGN KEY (id_producto) REFERENCES public.productos(id);


--
-- Name: pedidos fk_pedidos_proveedor; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedidos
    ADD CONSTRAINT fk_pedidos_proveedor FOREIGN KEY (id_proveedor) REFERENCES public.proveedores(id);


--
-- Name: pedidos fk_pedidos_usuario; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.pedidos
    ADD CONSTRAINT fk_pedidos_usuario FOREIGN KEY (id_usuario) REFERENCES public.usuarios(id);


--
-- Name: productos fk_productos_categoria; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.productos
    ADD CONSTRAINT fk_productos_categoria FOREIGN KEY (id_categoria) REFERENCES public.categorias(id);


--
-- Name: productos fk_productos_tipo; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.productos
    ADD CONSTRAINT fk_productos_tipo FOREIGN KEY (id_tipo) REFERENCES public.tipos(id);


--
-- Name: servicios fk_servicio_cliente; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicios
    ADD CONSTRAINT fk_servicio_cliente FOREIGN KEY (id_cliente) REFERENCES public.clientes(id);


--
-- Name: servicios fk_servicio_usuario; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicios
    ADD CONSTRAINT fk_servicio_usuario FOREIGN KEY (id_usuario) REFERENCES public.usuarios(id);


--
-- Name: servicio_detalle fk_serviciodetalle_pedido; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicio_detalle
    ADD CONSTRAINT fk_serviciodetalle_pedido FOREIGN KEY (id_pedido) REFERENCES public.pedidos(id);


--
-- Name: servicio_detalle fk_serviciodetalle_producto; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicio_detalle
    ADD CONSTRAINT fk_serviciodetalle_producto FOREIGN KEY (id_producto) REFERENCES public.productos(id);


--
-- Name: servicio_detalle fk_serviciodetalle_servicio; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.servicio_detalle
    ADD CONSTRAINT fk_serviciodetalle_servicio FOREIGN KEY (id_servicio) REFERENCES public.servicios(id);


--
-- Name: ventas fk_venta_cliente; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.ventas
    ADD CONSTRAINT fk_venta_cliente FOREIGN KEY (id_cliente) REFERENCES public.clientes(id);


--
-- Name: ventas fk_venta_usuario; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.ventas
    ADD CONSTRAINT fk_venta_usuario FOREIGN KEY (id_usuario) REFERENCES public.usuarios(id);


--
-- Name: venta_detalle fk_ventadetalle_pedido; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.venta_detalle
    ADD CONSTRAINT fk_ventadetalle_pedido FOREIGN KEY (id_pedido) REFERENCES public.pedidos(id);


--
-- Name: venta_detalle fk_ventadetalle_producto; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.venta_detalle
    ADD CONSTRAINT fk_ventadetalle_producto FOREIGN KEY (id_producto) REFERENCES public.productos(id);


--
-- Name: venta_detalle fk_ventadetalle_venta; Type: FK CONSTRAINT; Schema: public; Owner: -
--

ALTER TABLE ONLY public.venta_detalle
    ADD CONSTRAINT fk_ventadetalle_venta FOREIGN KEY (id_venta) REFERENCES public.ventas(id);


--
-- PostgreSQL database dump complete
--

\unrestrict f5OrNGsqq3lXZfASjfZClhWTE6J9ra0iNgidj8HHRi2NRehsEqLZedJHwwbqMgi

-- INSERT DE CONFIGURACION INICIAL (configurar)

INSERT INTO configuracion (id, nombre, direccion, ciudad, codigo_postal, provincia, telefono, email, cond_iva, cuit, inicio_act, iva, hora_apertura_maniana, hora_cierre_maniana, hora_apertura_tarde, hora_cierre_tarde, cargo_cancelacion_servicio)
    VALUES (1, 'ByteCenter','José Hernández 642','Crespo','3116','Entre Rios','3434737904','contacto@bytecenter.com','consumidor_final','30709707635','2026-05-01', 21.00, '08:00', '12:00', '16:00', '20:00', 15000.00);

-- INSERT DE USUARIO (configurar) (rol = 'admin')

INSERT INTO usuarios (nombre, apellido, usuario, password, telefono, email, rol)
    VALUES (...);