--
-- PostgreSQL database dump
--

\restrict grExcFIolufdUjz4hXW9CjHHt3zfzTpTl9JUsa87JnMRjZtCNiqgyMCaA7SENuZ

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

--
-- Name: address_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.address_id_seq OWNER TO factorytrace;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: addresses; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.addresses (
    address_id integer NOT NULL,
    client_id integer,
    name character varying,
    address character varying,
    country_id integer,
    city character varying
);


ALTER TABLE public.addresses OWNER TO factorytrace;

--
-- Name: addresses_address_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.addresses_address_id_seq OWNER TO factorytrace;

--
-- Name: addresses_address_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.addresses_address_id_seq OWNED BY public.addresses.address_id;


--
-- Name: categories; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.categories (
    category_id smallint NOT NULL,
    name character varying,
    standar_code character varying,
    reference character varying,
    material character varying
);


ALTER TABLE public.categories OWNER TO factorytrace;

--
-- Name: categories_category_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

CREATE SEQUENCE public.categories_category_id_seq
    AS smallint
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.categories_category_id_seq OWNER TO factorytrace;

--
-- Name: categories_category_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.categories_category_id_seq OWNED BY public.categories.category_id;


--
-- Name: clients; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.clients (
    client_id smallint NOT NULL,
    name character varying,
    address character varying,
    phonenumber1 character varying,
    phonenumber2 character varying,
    contact_name character varying
);


ALTER TABLE public.clients OWNER TO factorytrace;

--
-- Name: clients_client_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

CREATE SEQUENCE public.clients_client_id_seq
    AS smallint
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.clients_client_id_seq OWNER TO factorytrace;

--
-- Name: clients_client_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.clients_client_id_seq OWNED BY public.clients.client_id;


--
-- Name: countries; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.countries (
    country_id smallint NOT NULL,
    name character varying
);


ALTER TABLE public.countries OWNER TO factorytrace;

--
-- Name: delivery_types; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.delivery_types (
    delivery_type_id smallint NOT NULL,
    name character varying
);


ALTER TABLE public.delivery_types OWNER TO factorytrace;

--
-- Name: incidents_id; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.incidents_id (
    incident_id smallint NOT NULL,
    name character varying,
    detail character varying,
    quantity integer,
    turn_incidents_id integer
);


ALTER TABLE public.incidents_id OWNER TO factorytrace;

--
-- Name: incidents_id_incident_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

CREATE SEQUENCE public.incidents_id_incident_id_seq
    AS smallint
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.incidents_id_incident_id_seq OWNER TO factorytrace;

--
-- Name: incidents_id_incident_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.incidents_id_incident_id_seq OWNED BY public.incidents_id.incident_id;


--
-- Name: input_types; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.input_types (
    input_type_id smallint NOT NULL,
    name character varying,
    reference character varying,
    standar_code character varying
);


ALTER TABLE public.input_types OWNER TO factorytrace;

--
-- Name: input_types_input_type_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

CREATE SEQUENCE public.input_types_input_type_id_seq
    AS smallint
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.input_types_input_type_id_seq OWNER TO factorytrace;

--
-- Name: input_types_input_type_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.input_types_input_type_id_seq OWNED BY public.input_types.input_type_id;


--
-- Name: inputs; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.inputs (
    input_id integer NOT NULL,
    barcode character varying,
    lot character varying,
    name character varying,
    supplier_id integer,
    input_type_id smallint,
    reception_date timestamp without time zone,
    quantity real,
    standar_code character varying,
    disponible real
);


ALTER TABLE public.inputs OWNER TO factorytrace;

--
-- Name: inputs_input_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.inputs_input_id_seq OWNER TO factorytrace;

--
-- Name: inputs_input_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.inputs_input_id_seq OWNED BY public.inputs.input_id;


--
-- Name: invoices_invoice_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.invoices_invoice_id_seq OWNER TO factorytrace;

--
-- Name: invoices; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.invoices (
    invoice_id integer DEFAULT nextval('public.invoices_invoice_id_seq'::regclass) NOT NULL,
    client_id integer,
    invoice_date timestamp without time zone
);


ALTER TABLE public.invoices OWNER TO factorytrace;

--
-- Name: invoices_products; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.invoices_products (
    invoice_id integer NOT NULL,
    product_id integer NOT NULL,
    quantity real,
    remission_id integer NOT NULL
);


ALTER TABLE public.invoices_products OWNER TO factorytrace;

--
-- Name: lines; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.lines (
    line_id smallint NOT NULL,
    name character varying
);


ALTER TABLE public.lines OWNER TO factorytrace;

--
-- Name: lines_line_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

CREATE SEQUENCE public.lines_line_id_seq
    AS smallint
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.lines_line_id_seq OWNER TO factorytrace;

--
-- Name: lines_line_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.lines_line_id_seq OWNED BY public.lines.line_id;


--
-- Name: lines_machines; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.lines_machines (
    line_id smallint NOT NULL,
    machine_id smallint NOT NULL
);


ALTER TABLE public.lines_machines OWNER TO factorytrace;

--
-- Name: machines; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.machines (
    machine_id smallint NOT NULL,
    name character varying,
    serial character varying
);


ALTER TABLE public.machines OWNER TO factorytrace;

--
-- Name: machines_machine_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

CREATE SEQUENCE public.machines_machine_id_seq
    AS smallint
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.machines_machine_id_seq OWNER TO factorytrace;

--
-- Name: machines_machine_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.machines_machine_id_seq OWNED BY public.machines.machine_id;


--
-- Name: operators; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.operators (
    operator_id integer NOT NULL,
    is_leader boolean,
    name character varying,
    document_number character varying,
    rh character varying,
    operator_type_id smallint
);


ALTER TABLE public.operators OWNER TO factorytrace;

--
-- Name: operators_operator_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.operators_operator_id_seq OWNER TO factorytrace;

--
-- Name: operators_operator_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.operators_operator_id_seq OWNED BY public.operators.operator_id;


--
-- Name: preproducts; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.preproducts (
    preproduct_id integer NOT NULL,
    measure integer,
    standar_code character varying,
    lot character varying,
    material character varying,
    weight real,
    caliber real,
    fabrication_date timestamp without time zone,
    turn_id integer,
    quantity integer,
    waste real,
    residue real,
    details character varying
);


ALTER TABLE public.preproducts OWNER TO factorytrace;

--
-- Name: preproducts_preproduct_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.preproducts_preproduct_id_seq OWNER TO factorytrace;

--
-- Name: preproducts_preproduct_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.preproducts_preproduct_id_seq OWNED BY public.preproducts.preproduct_id;


--
-- Name: products; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.products (
    product_id integer NOT NULL,
    fabrication_date timestamp without time zone,
    name character varying,
    barcode character varying,
    category_id smallint,
    product_status_id smallint,
    turn_id integer,
    sale_order_id integer,
    weight real,
    waste real,
    supplier_id integer,
    quantity real,
    available integer
);


ALTER TABLE public.products OWNER TO factorytrace;

--
-- Name: products_inputs; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.products_inputs (
    product_id integer NOT NULL,
    input_id integer NOT NULL
);


ALTER TABLE public.products_inputs OWNER TO factorytrace;

--
-- Name: products_product_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.products_product_id_seq OWNER TO factorytrace;

--
-- Name: products_product_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.products_product_id_seq OWNED BY public.products.product_id;


--
-- Name: products_status; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.products_status (
    product_status_id smallint NOT NULL,
    name character varying,
    description character varying
);


ALTER TABLE public.products_status OWNER TO factorytrace;

--
-- Name: products_technical_data; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.products_technical_data (
    product_id integer NOT NULL,
    reference character varying,
    article character varying,
    product_group character varying,
    presentation character varying,
    cai character varying,
    height numeric,
    width numeric,
    square_meters numeric,
    diameter numeric,
    length numeric,
    angle numeric,
    sale_value numeric,
    rental_value numeric
);


ALTER TABLE public.products_technical_data OWNER TO factorytrace;

--
-- Name: remissions; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.remissions (
    remission_id integer NOT NULL,
    client_id integer,
    address_id integer,
    request_date timestamp without time zone,
    deliver_date timestamp without time zone,
    name character varying,
    is_delivery boolean
);


ALTER TABLE public.remissions OWNER TO factorytrace;

--
-- Name: remission_remission_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.remission_remission_id_seq OWNER TO factorytrace;

--
-- Name: remission_remission_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.remission_remission_id_seq OWNED BY public.remissions.remission_id;


--
-- Name: remissions_products; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.remissions_products (
    remission_id integer NOT NULL,
    product_id integer NOT NULL,
    quantity real,
    full_delivered boolean,
    quantity_for_return integer
);


ALTER TABLE public.remissions_products OWNER TO factorytrace;

--
-- Name: remissions_remission_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.remissions_remission_id_seq OWNER TO factorytrace;

--
-- Name: returns_return_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.returns_return_id_seq OWNER TO factorytrace;

--
-- Name: returns; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.returns (
    return_id integer DEFAULT nextval('public.returns_return_id_seq'::regclass) NOT NULL,
    client_id integer,
    return_date timestamp without time zone
);


ALTER TABLE public.returns OWNER TO factorytrace;

--
-- Name: returns_products; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.returns_products (
    return_id integer NOT NULL,
    product_id integer NOT NULL,
    quantity real,
    remission_id integer NOT NULL
);


ALTER TABLE public.returns_products OWNER TO factorytrace;

--
-- Name: sale_order_status; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.sale_order_status (
    sale_order_status_id smallint NOT NULL,
    name character varying,
    description character varying
);


ALTER TABLE public.sale_order_status OWNER TO factorytrace;

--
-- Name: sale_orders; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.sale_orders (
    sale_order_id integer NOT NULL,
    internal_code character varying,
    order_date timestamp without time zone,
    client_id smallint,
    description character varying,
    delivery_type_id smallint,
    sale_order_status_id smallint
);


ALTER TABLE public.sale_orders OWNER TO factorytrace;

--
-- Name: sale_orders_categories; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.sale_orders_categories (
    sale_order_id integer NOT NULL,
    category_id smallint NOT NULL,
    quantity double precision
);


ALTER TABLE public.sale_orders_categories OWNER TO factorytrace;

--
-- Name: sale_orders_sale_order_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.sale_orders_sale_order_id_seq OWNER TO factorytrace;

--
-- Name: sale_orders_sale_order_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.sale_orders_sale_order_id_seq OWNED BY public.sale_orders.sale_order_id;


--
-- Name: supplier_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.supplier_id_seq OWNER TO factorytrace;

--
-- Name: suppliers; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.suppliers (
    supplier_id integer NOT NULL,
    name character varying,
    address character varying,
    phonenumber1 character varying,
    phonenumber2 character varying,
    contact_name character varying
);


ALTER TABLE public.suppliers OWNER TO factorytrace;

--
-- Name: suppliers_input_types; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.suppliers_input_types (
    supplier_id integer,
    input_type_id integer
);


ALTER TABLE public.suppliers_input_types OWNER TO factorytrace;

--
-- Name: suppliers_supplier_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.suppliers_supplier_id_seq OWNER TO factorytrace;

--
-- Name: suppliers_supplier_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.suppliers_supplier_id_seq OWNED BY public.suppliers.supplier_id;


--
-- Name: turn_incidents; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.turn_incidents (
    turn_incident_id integer NOT NULL,
    turn_id integer,
    description character varying,
    title character varying
);


ALTER TABLE public.turn_incidents OWNER TO factorytrace;

--
-- Name: turn_incidents_turn_incident_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.turn_incidents_turn_incident_id_seq OWNER TO factorytrace;

--
-- Name: turn_incidents_turn_incident_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.turn_incidents_turn_incident_id_seq OWNED BY public.turn_incidents.turn_incident_id;


--
-- Name: turn_types; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.turn_types (
    turn_type_id integer NOT NULL,
    initial_hour time without time zone,
    final_hour time without time zone,
    description character varying
);


ALTER TABLE public.turn_types OWNER TO factorytrace;

--
-- Name: turns; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.turns (
    turn_id integer NOT NULL,
    line_id smallint,
    start_time timestamp without time zone,
    end_time timestamp without time zone,
    turn_type_id integer,
    waste real,
    residue real,
    waste_desc character varying,
    peletizado character varying,
    original character varying
);


ALTER TABLE public.turns OWNER TO factorytrace;

--
-- Name: turns_operators; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.turns_operators (
    turn_id integer NOT NULL,
    operator_id integer NOT NULL
);


ALTER TABLE public.turns_operators OWNER TO factorytrace;

--
-- Name: turns_turn_id_seq; Type: SEQUENCE; Schema: public; Owner: factorytrace
--

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


ALTER TABLE public.turns_turn_id_seq OWNER TO factorytrace;

--
-- Name: turns_turn_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: factorytrace
--

ALTER SEQUENCE public.turns_turn_id_seq OWNED BY public.turns.turn_id;


--
-- Name: units_measure; Type: TABLE; Schema: public; Owner: factorytrace
--

CREATE TABLE public.units_measure (
    name character varying,
    standar_code character varying NOT NULL
);


ALTER TABLE public.units_measure OWNER TO factorytrace;

--
-- Name: addresses address_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.addresses ALTER COLUMN address_id SET DEFAULT nextval('public.addresses_address_id_seq'::regclass);


--
-- Name: categories category_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.categories ALTER COLUMN category_id SET DEFAULT nextval('public.categories_category_id_seq'::regclass);


--
-- Name: clients client_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.clients ALTER COLUMN client_id SET DEFAULT nextval('public.clients_client_id_seq'::regclass);


--
-- Name: incidents_id incident_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.incidents_id ALTER COLUMN incident_id SET DEFAULT nextval('public.incidents_id_incident_id_seq'::regclass);


--
-- Name: input_types input_type_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.input_types ALTER COLUMN input_type_id SET DEFAULT nextval('public.input_types_input_type_id_seq'::regclass);


--
-- Name: inputs input_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.inputs ALTER COLUMN input_id SET DEFAULT nextval('public.inputs_input_id_seq'::regclass);


--
-- Name: lines line_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.lines ALTER COLUMN line_id SET DEFAULT nextval('public.lines_line_id_seq'::regclass);


--
-- Name: machines machine_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.machines ALTER COLUMN machine_id SET DEFAULT nextval('public.machines_machine_id_seq'::regclass);


--
-- Name: operators operator_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.operators ALTER COLUMN operator_id SET DEFAULT nextval('public.operators_operator_id_seq'::regclass);


--
-- Name: preproducts preproduct_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.preproducts ALTER COLUMN preproduct_id SET DEFAULT nextval('public.preproducts_preproduct_id_seq'::regclass);


--
-- Name: products product_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products ALTER COLUMN product_id SET DEFAULT nextval('public.products_product_id_seq'::regclass);


--
-- Name: remissions remission_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.remissions ALTER COLUMN remission_id SET DEFAULT nextval('public.remission_remission_id_seq'::regclass);


--
-- Name: sale_orders sale_order_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders ALTER COLUMN sale_order_id SET DEFAULT nextval('public.sale_orders_sale_order_id_seq'::regclass);


--
-- Name: suppliers supplier_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.suppliers ALTER COLUMN supplier_id SET DEFAULT nextval('public.suppliers_supplier_id_seq'::regclass);


--
-- Name: turn_incidents turn_incident_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turn_incidents ALTER COLUMN turn_incident_id SET DEFAULT nextval('public.turn_incidents_turn_incident_id_seq'::regclass);


--
-- Name: turns turn_id; Type: DEFAULT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns ALTER COLUMN turn_id SET DEFAULT nextval('public.turns_turn_id_seq'::regclass);


--
-- Data for Name: addresses; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.addresses (address_id, client_id, name, address, country_id, city) FROM stdin;
11	3	CAMILO MORENO 	AV. CALLE 64C # 69J 11/ BOSQUE POPULAR	10	BOGOTA 
12	4	Minuto de Dios 	Dig 82g#72c-38	10	Bogota
13	1	proyecto 1	cra 1	10	Bogotá
\.


--
-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.categories (category_id, name, standar_code, reference, material) FROM stdin;
1	GENERAL	kg		
\.


--
-- Data for Name: clients; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.clients (client_id, name, address, phonenumber1, phonenumber2, contact_name) FROM stdin;
1	cliente 1	cra 1;Bogotá	123	123	123
2	cliente 2	cra 2;Bogotá	123	123	123
3	CONSTRUCTORA SAESMA SAS 	TV 60 #115-58;BOGOTA	3142880804	3202735651	901475430-0
4	NELSON URREGO 	DIG 82G#72C-38;BOGOTA	3175101943	NINGUNO 	1
\.


--
-- Data for Name: countries; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.countries (country_id, name) FROM stdin;
1	Antigua y Barbuda
2	Argentina
3	Bahamas
4	Barbados
5	Belice
6	Bolivia
7	Brasil
8	Canadá
9	Chile
10	Colombia
11	Costa Rica
12	Cuba
13	Dominica
14	Ecuador
15	El Salvador
16	Estados Unidos
17	Granada
18	Guatemala
19	Guyana
20	Haití
21	Honduras
22	Jamaica
23	México
24	Nicaragua
25	Panamá
26	Paraguay
27	Perú
28	República Dominicana
29	San Cristóbal y Nieves
30	San Vicente y las Granadinas
31	Santa Lucía
32	Surinam
33	Trinidad y Tobago
34	Uruguay
35	Venezuela
\.


--
-- Data for Name: delivery_types; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.delivery_types (delivery_type_id, name) FROM stdin;
\.


--
-- Data for Name: incidents_id; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.incidents_id (incident_id, name, detail, quantity, turn_incidents_id) FROM stdin;
\.


--
-- Data for Name: input_types; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.input_types (input_type_id, name, reference, standar_code) FROM stdin;
\.


--
-- Data for Name: inputs; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.inputs (input_id, barcode, lot, name, supplier_id, input_type_id, reception_date, quantity, standar_code, disponible) FROM stdin;
\.


--
-- Data for Name: invoices; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.invoices (invoice_id, client_id, invoice_date) FROM stdin;
6	1	2025-09-23 00:00:00
\.


--
-- Data for Name: invoices_products; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.invoices_products (invoice_id, product_id, quantity, remission_id) FROM stdin;
6	4	20	7
6	9	50	7
6	49	9	7
\.


--
-- Data for Name: lines; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.lines (line_id, name) FROM stdin;
\.


--
-- Data for Name: lines_machines; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.lines_machines (line_id, machine_id) FROM stdin;
\.


--
-- Data for Name: machines; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.machines (machine_id, name, serial) FROM stdin;
\.


--
-- Data for Name: operators; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.operators (operator_id, is_leader, name, document_number, rh, operator_type_id) FROM stdin;
\.


--
-- Data for Name: preproducts; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.preproducts (preproduct_id, measure, standar_code, lot, material, weight, caliber, fabrication_date, turn_id, quantity, waste, residue, details) FROM stdin;
\.


--
-- Data for Name: products; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.products (product_id, fabrication_date, name, barcode, category_id, product_status_id, turn_id, sale_order_id, weight, waste, supplier_id, quantity, available) FROM stdin;
44	2025-08-15 00:00:00	Tablero 35 X 120 cm.	\N	1	1	\N	\N	0	0	27	92	92
103	2025-08-15 00:00:00	Diagonales 240 cm	\N	1	1	\N	\N	0	0	27	48	48
104	2025-08-15 00:00:00	Diagonales 280 cm	\N	1	1	\N	\N	0	0	27	48	48
105	2025-08-15 00:00:00	Escalera gato	\N	1	1	\N	\N	0	0	27	20	20
106	2025-08-15 00:00:00	horizontales 140 cm	\N	1	1	\N	\N	0	0	27	82	82
108	2025-08-15 00:00:00	Horizontales 207 cm	\N	1	1	\N	\N	0	0	27	97	97
18	2025-08-15 00:00:00	Collarines	\N	1	1	\N	\N	0	0	27	41	41
109	2025-08-15 00:00:00	Horizontales 60 cm	\N	1	1	\N	\N	0	0	27	12	12
110	2025-08-15 00:00:00	Niveladores unidireccionales	\N	1	1	\N	\N	0	0	27	41	41
111	2025-08-15 00:00:00	Plataforma Certificada  140cm	\N	1	1	\N	\N	0	0	27	38	38
112	2025-08-15 00:00:00	Plataforma certificada  216cm	\N	1	1	\N	\N	0	0	27	9	9
113	2025-08-15 00:00:00	Plataforma certificada  300cm	\N	1	1	\N	\N	0	0	27	8	8
114	2025-08-15 00:00:00	Ruedas Andamio Unidireccional	\N	1	1	\N	\N	0	0	27	28	28
102	2025-08-15 00:00:00	Paral Metalico Largo  210cm	\N	1	1	\N	\N	0	0	27	830	830
117	2025-08-15 00:00:00	Verticales 200 cm	\N	1	1	\N	\N	0	0	27	99	99
20	2025-08-15 00:00:00	Distanciador HR 15cm	\N	1	1	\N	\N	0	0	27	131	131
21	2025-08-15 00:00:00	Distanciador HR 16cm	\N	1	1	\N	\N	0	0	27	40	40
22	2025-08-15 00:00:00	Distanciador HR 18cm	\N	1	1	\N	\N	0	0	27	4	4
23	2025-08-15 00:00:00	Distanciador HR 20cm	\N	1	1	\N	\N	0	0	27	134	134
24	2025-08-15 00:00:00	Distanciador HR 25cm	\N	1	1	\N	\N	0	0	27	67	67
25	2025-08-15 00:00:00	Distanciador HR 30cm	\N	1	1	\N	\N	0	0	27	112	112
26	2025-08-15 00:00:00	Distanciador HR 32cm	\N	1	1	\N	\N	0	0	27	12	12
27	2025-08-15 00:00:00	Distanciador HR 35cm	\N	1	1	\N	\N	0	0	27	56	56
28	2025-08-15 00:00:00	Distanciador HR 40cm	\N	1	1	\N	\N	0	0	27	42	42
29	2025-08-15 00:00:00	Distanciador HR 45cm	\N	1	1	\N	\N	0	0	27	17	17
30	2025-08-15 00:00:00	Distanciador HR 50cm	\N	1	1	\N	\N	0	0	27	9	9
32	2025-08-15 00:00:00	Pin Sencillo	\N	1	1	\N	\N	0	0	27	113	113
33	2025-08-15 00:00:00	Rinconera 15 X 10 X 120cm.	\N	1	1	\N	\N	0	0	27	16	16
34	2025-08-15 00:00:00	Rinconera 15 X 10 X 60cm.	\N	1	1	\N	\N	0	0	27	4	4
35	2025-08-15 00:00:00	Tablero  15 X 120 cm.	\N	1	1	\N	\N	0	0	27	24	24
36	2025-08-15 00:00:00	Tablero  25 X 35 cm.	\N	1	1	\N	\N	0	0	27	25	25
37	2025-08-15 00:00:00	Tablero  30 X40 cm.	\N	1	1	\N	\N	0	0	27	3	3
38	2025-08-15 00:00:00	Tablero  35 X 40 cm.	\N	1	1	\N	\N	0	0	27	2	2
39	2025-08-15 00:00:00	Tablero  50 X 40 cm.	\N	1	1	\N	\N	0	0	27	10	10
40	2025-08-15 00:00:00	Tablero 20 X 120 cm.	\N	1	1	\N	\N	0	0	27	45	45
41	2025-08-15 00:00:00	Tablero 20 X 30 cm.	\N	1	1	\N	\N	0	0	27	1	1
45	2025-08-15 00:00:00	Tablero 40 X 120 cm.	\N	1	1	\N	\N	0	0	27	76	76
57	2025-08-15 00:00:00	Tensor	\N	1	1	\N	\N	0	0	27	95	95
46	2025-08-15 00:00:00	Tablero 40 X 60 cm.	\N	1	1	\N	\N	0	0	27	18	18
48	2025-08-15 00:00:00	Tablero 50 X 120 cm.	\N	1	1	\N	\N	0	0	27	82	82
4	2025-08-15 00:00:00	Perros	\N	1	1	\N	\N	0	0	27	200	198
50	2025-08-15 00:00:00	Tablero 55 X 120 cm.	\N	1	1	\N	\N	0	0	27	20	20
51	2025-08-15 00:00:00	Tablero 55 X 60 cm.	\N	1	1	\N	\N	0	0	27	23	23
52	2025-08-15 00:00:00	Tablero 60 X 120 cm.	\N	1	1	\N	\N	0	0	27	44	44
53	2025-08-15 00:00:00	Tablero 60 X 20 cm.	\N	1	1	\N	\N	0	0	27	10	10
54	2025-08-15 00:00:00	Tablero 60 X 25 cm.	\N	1	1	\N	\N	0	0	27	30	30
58	2025-08-15 00:00:00	Lamina 30 X 240 cm	\N	1	1	\N	\N	0	0	27	4	4
59	2025-08-15 00:00:00	Camilla  120 X 60 cm	\N	1	1	\N	\N	0	0	27	50	50
60	2025-08-15 00:00:00	Camilla  50 X 140cm	\N	1	1	\N	\N	0	0	27	141	141
61	2025-08-15 00:00:00	Camilla  70 X 100cm	\N	1	1	\N	\N	0	0	27	127	127
62	2025-08-15 00:00:00	Camilla  70 X 110cm	\N	1	1	\N	\N	0	0	27	98	98
63	2025-08-15 00:00:00	Camilla  70 X 120cm	\N	1	1	\N	\N	0	0	27	96	96
64	2025-08-15 00:00:00	Camilla  70 X 140 cm	\N	1	1	\N	\N	0	0	27	1761	1761
65	2025-08-15 00:00:00	Camilla 30 X 120 cm	\N	1	1	\N	\N	0	0	27	20	20
66	2025-08-15 00:00:00	Camilla 40 X 100 cm	\N	1	1	\N	\N	0	0	27	50	50
67	2025-08-15 00:00:00	Camilla 40 X 130 cm	\N	1	1	\N	\N	0	0	27	20	20
100	2025-08-15 00:00:00	Paral metalico enano 110 cm	\N	1	1	\N	\N	0	0	27	228	228
101	2025-08-15 00:00:00	Paral metalico extralargo 300cm	\N	1	1	\N	\N	0	0	27	197	197
3	2025-08-15 00:00:00	Pasamanos Metalico	\N	1	1	\N	\N	0	0	27	30	30
9	2025-08-15 00:00:00	Marco Andamio 80	\N	1	1	\N	\N	0	0	27	145	125
5	2025-08-15 00:00:00	Plataforma Normal  300 cm	\N	1	1	\N	\N	0	0	27	41	41
6	2025-08-15 00:00:00	Plataforma normal 400cm	\N	1	1	\N	\N	0	0	27	2	2
7	2025-08-15 00:00:00	Marco Andamio 1.30	\N	1	1	\N	\N	0	0	27	34	34
107	2025-08-15 00:00:00	horizontales 152 cm	\N	1	1	\N	\N	0	0	27	10	10
49	2025-08-15 00:00:00	Tablero 50 X 60 cm.	\N	1	1	\N	\N	0	0	27	9	7
10	2025-08-15 00:00:00	Niveladores normales	\N	1	1	\N	\N	0	0	27	16	16
11	2025-08-15 00:00:00	Ruedas de Andamio Nor t.grande	\N	1	1	\N	\N	0	0	27	40	40
12	2025-08-15 00:00:00	Ruedas de Andamio t.pequeño	\N	1	1	\N	\N	0	0	27	8	8
13	2025-08-15 00:00:00	Alineador  240 cm	\N	1	1	\N	\N	0	0	27	2	2
14	2025-08-15 00:00:00	Alineador 400 X 400	\N	1	1	\N	\N	0	0	27	2	2
15	2025-08-15 00:00:00	Angulo 120 cm	\N	1	1	\N	\N	0	0	27	20	18
17	2025-08-15 00:00:00	Angulo 60 cm.	\N	1	1	\N	\N	0	0	27	97	97
43	2025-08-15 00:00:00	Tablero 30 X 120 cm.	\N	1	1	\N	\N	0	0	27	135	103
55	2025-08-15 00:00:00	Tablero 60 X 30 cm.	\N	1	1	\N	\N	0	0	27	21	2
69	2025-08-15 00:00:00	Camilla 50 X 100 cm	\N	1	1	\N	\N	0	0	27	70	70
2	2025-08-15 00:00:00	Pasamanos Madera	\N	1	1	\N	\N	0	0	27	4	4
8	2025-08-15 00:00:00	Marco Andamio 1.50	\N	1	1	\N	\N	0	0	27	251	251
115	2025-08-15 00:00:00	Verticales 100 cm	\N	1	1	\N	\N	0	0	27	12	12
116	2025-08-15 00:00:00	Verticales 150 cm	\N	1	1	\N	\N	0	0	27	4	4
70	2025-08-15 00:00:00	camilla 50 X 120 cm	\N	1	1	\N	\N	0	0	27	120	120
16	2025-08-15 00:00:00	Angulo 240cm	\N	1	1	\N	\N	0	0	27	211	195
31	2025-08-15 00:00:00	Grapa	\N	1	1	\N	\N	0	0	27	5730	5110
47	2025-08-15 00:00:00	Tablero 45 X 120 cm.	\N	1	2	\N	\N	0	0	27	29	0
56	2025-08-15 00:00:00	Tablero 60 X 35 cm.	\N	1	1	\N	\N	0	0	27	12	1
99	2025-08-15 00:00:00	Paral Metalico Corto 160cm	\N	1	1	\N	\N	0	0	27	949	925
118	2025-09-02 00:00:00	Tablero Reformado 	\N	1	2	\N	\N	0	0	27	3	0
119	2025-09-02 00:00:00	Tornillos	\N	1	2	\N	\N	0	0	27	160	0
120	2025-09-02 00:00:00	Cuellos Irregulares de 35	\N	1	1	\N	\N	0	0	27	12	10
1	2025-08-15 00:00:00	Ganchos Andamio	\N	1	1	\N	\N	0	0	27	25	25
71	2025-08-15 00:00:00	Camilla 60 X 140 cm	\N	1	1	\N	\N	0	0	27	25	25
72	2025-08-15 00:00:00	Camilla 70 X 90 cm	\N	1	1	\N	\N	0	0	27	88	88
73	2025-08-15 00:00:00	Camillas 70 X 130 cm	\N	1	1	\N	\N	0	0	27	61	61
74	2025-08-15 00:00:00	Planchones  300 a 350	\N	1	1	\N	\N	0	0	27	220	220
75	2025-08-15 00:00:00	Planchones  400 a 600	\N	1	1	\N	\N	0	0	27	20	20
76	2025-08-15 00:00:00	Planchones 200cm	\N	1	1	\N	\N	0	0	27	20	20
77	2025-08-15 00:00:00	Planchones 250 a 280	\N	1	1	\N	\N	0	0	27	68	68
78	2025-08-15 00:00:00	balde pluma	\N	1	1	\N	\N	0	0	27	8	8
79	2025-08-15 00:00:00	Bomba Sumergible	\N	1	1	\N	\N	0	0	27	3	3
80	2025-08-15 00:00:00	Canastilla	\N	1	1	\N	\N	0	0	27	1	1
81	2025-08-15 00:00:00	Canguro	\N	1	1	\N	\N	0	0	27	4	4
82	2025-08-15 00:00:00	Cortadora de Ladrillo	\N	1	1	\N	\N	0	0	27	3	3
83	2025-08-15 00:00:00	Cortadora de Piso	\N	1	1	\N	\N	0	0	27	1	1
84	2025-08-15 00:00:00	Demoledor	\N	1	1	\N	\N	0	0	27	9	9
85	2025-08-15 00:00:00	EXTENCION	\N	1	1	\N	\N	0	0	27	4	4
86	2025-08-15 00:00:00	Mezcladora Grande	\N	1	1	\N	\N	0	0	27	6	6
87	2025-08-15 00:00:00	Mezcladora Pequeña	\N	1	1	\N	\N	0	0	27	1	1
88	2025-08-15 00:00:00	Pluma	\N	1	1	\N	\N	0	0	27	5	5
89	2025-08-15 00:00:00	Rana Vibradora	\N	1	1	\N	\N	0	0	27	4	4
90	2025-08-15 00:00:00	Vibrador	\N	1	1	\N	\N	0	0	27	5	5
91	2025-08-15 00:00:00	Cercha  200 cm	\N	1	1	\N	\N	0	0	27	20	20
19	2025-08-15 00:00:00	Distanciador HR 12cm	\N	1	1	\N	\N	0	0	27	50	50
42	2025-08-15 00:00:00	Tablero 25 X 120 cm.	\N	1	1	\N	\N	0	0	27	75	75
68	2025-08-15 00:00:00	Camilla 40 X 140 cm	\N	1	1	\N	\N	0	0	27	365	365
92	2025-08-15 00:00:00	Cercha  300 cm	\N	1	1	\N	\N	0	0	27	979	979
93	2025-08-15 00:00:00	Cercha 150cm	\N	1	1	\N	\N	0	0	27	9	9
94	2025-08-15 00:00:00	Cercha 250 cm	\N	1	1	\N	\N	0	0	27	7	7
95	2025-08-15 00:00:00	Cruceta  250cm	\N	1	1	\N	\N	0	0	27	303	303
96	2025-08-15 00:00:00	Cruceta 195cm	\N	1	1	\N	\N	0	0	27	453	453
97	2025-08-15 00:00:00	Cruceta 200 cm	\N	1	1	\N	\N	0	0	27	50	50
98	2025-08-15 00:00:00	Cruceta 330 cm	\N	1	1	\N	\N	0	0	27	526	526
\.


--
-- Data for Name: products_inputs; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.products_inputs (product_id, input_id) FROM stdin;
\.


--
-- Data for Name: products_status; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.products_status (product_status_id, name, description) FROM stdin;
1	Disponible	Producto activo y disponible para pedidos
2	Ocupado	Producto inactivo y no disponible para pedidos
\.


--
-- Data for Name: products_technical_data; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.products_technical_data (product_id, reference, article, product_group, presentation, cai, height, width, square_meters, diameter, length, angle, sale_value, rental_value) FROM stdin;
1			ANDAMIO COLGANTE			0	0	0	0	0	0	0	0
2			ANDAMIO COLGANTE			0	0	0	0	0	0	0	0
4			ANDAMIO COLGANTE			0	0	0	0	0	0	0	0
113			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
6			ANDAMIO COLGANTE			0	0	0	0	0	0	0	0
7			ANDAMIO TUBULAR			0	0	0	0	0	0	0	0
115			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
9			ANDAMIO TUBULAR			0	0	0	0	0	0	0	0
10			ANDAMIO TUBULAR			0	0	0	0	0	0	0	0
11			ANDAMIO TUBULAR			0	0	0	0	0	0	0	0
71			MADERA			0	0	0	0	0	0	0	0
12			ANDAMIO TUBULAR			0	0	0	0	0	0	0	0
14			ENCOFRADO			0	0	0	0	0	0	0	0
15			ENCOFRADO			0	0	0	0	0	0	0	0
16			ENCOFRADO			0	0	0	0	0	0	0	0
17			ENCOFRADO			0	0	0	0	0	0	0	0
72			MADERA			0	0	0	0	0	0	0	0
73			MADERA			0	0	0	0	0	0	0	0
74			MADERA			0	0	0	0	0	0	0	0
75			MADERA			0	0	0	0	0	0	0	0
76			MADERA			0	0	0	0	0	0	0	0
77			MADERA			0	0	0	0	0	0	0	0
78			MAQUINARIA			0	0	0	0	0	0	0	0
79			MAQUINARIA			0	0	0	0	0	0	0	0
80			MAQUINARIA			0	0	0	0	0	0	0	0
81			MAQUINARIA			0	0	0	0	0	0	0	0
82			MAQUINARIA			0	0	0	0	0	0	0	0
83			MAQUINARIA			0	0	0	0	0	0	0	0
84			MAQUINARIA			0	0	0	0	0	0	0	0
18			ENCOFRADO			0	0	0	0	0	0	0	0
19			ENCOFRADO			0	0	0	0	0	0	0	0
20			ENCOFRADO			0	0	0	0	0	0	0	0
21			ENCOFRADO			0	0	0	0	0	0	0	0
22			ENCOFRADO			0	0	0	0	0	0	0	0
23			ENCOFRADO			0	0	0	0	0	0	0	0
24			ENCOFRADO			0	0	0	0	0	0	0	0
25			ENCOFRADO			0	0	0	0	0	0	0	0
26			ENCOFRADO			0	0	0	0	0	0	0	0
27			ENCOFRADO			0	0	0	0	0	0	0	0
28			ENCOFRADO			0	0	0	0	0	0	0	0
29			ENCOFRADO			0	0	0	0	0	0	0	0
30			ENCOFRADO			0	0	0	0	0	0	0	0
31			ENCOFRADO			0	0	0	0	0	0	0	0
32			ENCOFRADO			0	0	0	0	0	0	0	0
33			ENCOFRADO			0	0	0	0	0	0	0	0
34			ENCOFRADO			0	0	0	0	0	0	0	0
35			ENCOFRADO			0	0	0	0	0	0	0	0
36			ENCOFRADO			0	0	0	0	0	0	0	0
37			ENCOFRADO			0	0	0	0	0	0	0	0
38			ENCOFRADO			0	0	0	0	0	0	0	0
39			ENCOFRADO			0	0	0	0	0	0	0	0
40			ENCOFRADO			0	0	0	0	0	0	0	0
41			ENCOFRADO			0	0	0	0	0	0	0	0
42			ENCOFRADO			0	0	0	0	0	0	0	0
43			ENCOFRADO			0	0	0	0	0	0	0	0
44			ENCOFRADO			0	0	0	0	0	0	0	0
45			ENCOFRADO			0	0	0	0	0	0	0	0
46			ENCOFRADO			0	0	0	0	0	0	0	0
47			ENCOFRADO			0	0	0	0	0	0	0	0
48			ENCOFRADO			0	0	0	0	0	0	0	0
49			ENCOFRADO			0	0	0	0	0	0	0	0
50			ENCOFRADO			0	0	0	0	0	0	0	0
51			ENCOFRADO			0	0	0	0	0	0	0	0
52			ENCOFRADO			0	0	0	0	0	0	0	0
53			ENCOFRADO			0	0	0	0	0	0	0	0
54			ENCOFRADO			0	0	0	0	0	0	0	0
55			ENCOFRADO			0	0	0	0	0	0	0	0
56			ENCOFRADO			0	0	0	0	0	0	0	0
85			MAQUINARIA			0	0	0	0	0	0	0	0
86			MAQUINARIA			0	0	0	0	0	0	0	0
87			MAQUINARIA			0	0	0	0	0	0	0	0
88			MAQUINARIA			0	0	0	0	0	0	0	0
89			MAQUINARIA			0	0	0	0	0	0	0	0
90			MAQUINARIA			0	0	0	0	0	0	0	0
91			METALICO			0	0	0	0	0	0	0	0
92			METALICO			0	0	0	0	0	0	0	0
93			METALICO			0	0	0	0	0	0	0	0
94			METALICO			0	0	0	0	0	0	0	0
95			METALICO			0	0	0	0	0	0	0	0
96			METALICO			0	0	0	0	0	0	0	0
97			METALICO			0	0	0	0	0	0	0	0
98			METALICO			0	0	0	0	0	0	0	0
99			METALICO			0	0	0	0	0	0	0	0
100			METALICO			0	0	0	0	0	0	0	0
101			METALICO			0	0	0	0	0	0	0	0
102			METALICO			0	0	0	0	0	0	0	0
103			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
104			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
105			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
106			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
107			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
108			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
109			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
57			ENCOFRADO			0	0	0	0	0	0	0	0
58			ENCOFRADO			0	0	0	0	0	0	0	0
59			MADERA			0	0	0	0	0	0	0	0
60			MADERA			0	0	0	0	0	0	0	0
61			MADERA			0	0	0	0	0	0	0	0
63			MADERA			0	0	0	0	0	0	0	0
64			MADERA			0	0	0	0	0	0	0	0
65			MADERA			0	0	0	0	0	0	0	0
66			MADERA			0	0	0	0	0	0	0	0
67			MADERA			0	0	0	0	0	0	0	0
68			MADERA			0	0	0	0	0	0	0	0
69			MADERA			0	0	0	0	0	0	0	0
70			MADERA			0	0	0	0	0	0	0	0
110			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
111			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
3			ANDAMIO COLGANTE			0	0	0	0	0	0	0	0
112			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
114			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
5			ANDAMIO COLGANTE			0	0	0	0	0	0	0	0
116			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
117			UNIDIRECCIONAL			0	0	0	0	0	0	0	0
8			ANDAMIO TUBULAR			0	0	0	0	0	0	0	0
13			ENCOFRADO			0	0	0	0	0	0	0	0
62			MADERA			0	0	0	0	0	0	0	0
118						0	0	0	0	0	0	0	0
119						0	0	0	0	0	0	0	0
120						0	35	0	0	0	0	0	0
\.


--
-- Data for Name: remissions; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.remissions (remission_id, client_id, address_id, request_date, deliver_date, name, is_delivery) FROM stdin;
3	3	11	2025-09-02 00:00:00	2025-09-02 00:00:00	Cindy Nohelia Pineda Santos	t
5	4	12	2025-07-10 00:00:00	2025-07-10 00:00:00	Cindy Nohelia Pineda Santos	t
6	3	11	2025-09-08 00:00:00	2025-09-08 00:00:00	Cindy Nohelia Pineda Santos	t
7	1	13	2025-09-03 00:00:00	2025-09-10 00:00:00		t
\.


--
-- Data for Name: remissions_products; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.remissions_products (remission_id, product_id, quantity, full_delivered, quantity_for_return) FROM stdin;
7	4	20	f	2
7	9	50	f	20
7	49	9	f	2
3	43	32	f	32
3	55	19	f	19
3	56	11	f	11
3	47	29	f	29
3	118	3	f	3
3	31	620	f	620
3	16	16	f	16
3	119	160	f	160
3	99	24	f	24
3	120	2	f	2
5	74	8	t	0
5	99	6	t	0
6	15	2	f	2
\.


--
-- Data for Name: returns; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.returns (return_id, client_id, return_date) FROM stdin;
34	1	2025-09-19 00:00:00
35	1	2025-09-19 00:00:00
36	1	2025-09-03 00:00:00
\.


--
-- Data for Name: returns_products; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.returns_products (return_id, product_id, quantity, remission_id) FROM stdin;
33	16	16	4
33	31	620	4
33	43	32	4
33	47	29	4
33	55	19	4
33	56	11	4
33	99	24	4
33	118	3	4
33	119	160	4
33	120	2	4
34	4	10	7
34	9	10	7
34	49	4	7
35	4	5	7
35	9	10	7
35	49	2	7
36	4	3	7
36	9	10	7
36	49	1	7
\.


--
-- Data for Name: sale_order_status; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.sale_order_status (sale_order_status_id, name, description) FROM stdin;
\.


--
-- Data for Name: sale_orders; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.sale_orders (sale_order_id, internal_code, order_date, client_id, description, delivery_type_id, sale_order_status_id) FROM stdin;
\.


--
-- Data for Name: sale_orders_categories; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.sale_orders_categories (sale_order_id, category_id, quantity) FROM stdin;
\.


--
-- Data for Name: suppliers; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.suppliers (supplier_id, name, address, phonenumber1, phonenumber2, contact_name) FROM stdin;
27	Bodega	Bodega	Bodega	Bodega	Bodega
28	AFORMAEQUIPOS	 Cra 91A # 128C - 18	3114827746	1	CARLOS RODRIGUEZ
\.


--
-- Data for Name: suppliers_input_types; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.suppliers_input_types (supplier_id, input_type_id) FROM stdin;
\.


--
-- Data for Name: turn_incidents; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.turn_incidents (turn_incident_id, turn_id, description, title) FROM stdin;
\.


--
-- Data for Name: turn_types; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.turn_types (turn_type_id, initial_hour, final_hour, description) FROM stdin;
\.


--
-- Data for Name: turns; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.turns (turn_id, line_id, start_time, end_time, turn_type_id, waste, residue, waste_desc, peletizado, original) FROM stdin;
\.


--
-- Data for Name: turns_operators; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.turns_operators (turn_id, operator_id) FROM stdin;
\.


--
-- Data for Name: units_measure; Type: TABLE DATA; Schema: public; Owner: factorytrace
--

COPY public.units_measure (name, standar_code) FROM stdin;
Metro	m
Pulgadas	pl
Kilogramos	kg
Paquete	pkg
\.


--
-- Name: address_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.address_id_seq', 1, false);


--
-- Name: addresses_address_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.addresses_address_id_seq', 13, true);


--
-- Name: categories_category_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.categories_category_id_seq', 3, true);


--
-- Name: clients_client_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.clients_client_id_seq', 4, true);


--
-- Name: incidents_id_incident_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.incidents_id_incident_id_seq', 27, true);


--
-- Name: input_types_input_type_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.input_types_input_type_id_seq', 45, true);


--
-- Name: inputs_input_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.inputs_input_id_seq', 746, true);


--
-- Name: invoices_invoice_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.invoices_invoice_id_seq', 6, true);


--
-- Name: lines_line_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.lines_line_id_seq', 79, true);


--
-- Name: machines_machine_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.machines_machine_id_seq', 11, true);


--
-- Name: operators_operator_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.operators_operator_id_seq', 18, true);


--
-- Name: preproducts_preproduct_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.preproducts_preproduct_id_seq', 25020, true);


--
-- Name: products_product_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.products_product_id_seq', 121, true);


--
-- Name: remission_remission_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.remission_remission_id_seq', 8, true);


--
-- Name: remissions_remission_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.remissions_remission_id_seq', 1, false);


--
-- Name: returns_return_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.returns_return_id_seq', 36, true);


--
-- Name: sale_orders_sale_order_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.sale_orders_sale_order_id_seq', 1, false);


--
-- Name: supplier_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.supplier_id_seq', 1, false);


--
-- Name: suppliers_supplier_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.suppliers_supplier_id_seq', 28, true);


--
-- Name: turn_incidents_turn_incident_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.turn_incidents_turn_incident_id_seq', 261, true);


--
-- Name: turns_turn_id_seq; Type: SEQUENCE SET; Schema: public; Owner: factorytrace
--

SELECT pg_catalog.setval('public.turns_turn_id_seq', 1, false);


--
-- Name: addresses addresses_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.addresses
    ADD CONSTRAINT addresses_pk PRIMARY KEY (address_id);


--
-- Name: categories categories_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.categories
    ADD CONSTRAINT categories_pk PRIMARY KEY (category_id);


--
-- Name: clients clients_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.clients
    ADD CONSTRAINT clients_pk PRIMARY KEY (client_id);


--
-- Name: countries countries_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.countries
    ADD CONSTRAINT countries_pk PRIMARY KEY (country_id);


--
-- Name: delivery_types delivery_types_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.delivery_types
    ADD CONSTRAINT delivery_types_pk PRIMARY KEY (delivery_type_id);


--
-- Name: incidents_id incidents_id_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.incidents_id
    ADD CONSTRAINT incidents_id_pk PRIMARY KEY (incident_id);


--
-- Name: input_types input_types_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.input_types
    ADD CONSTRAINT input_types_pk PRIMARY KEY (input_type_id);


--
-- Name: inputs inputs_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.inputs
    ADD CONSTRAINT inputs_pk PRIMARY KEY (input_id);


--
-- Name: invoices invoices_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.invoices
    ADD CONSTRAINT invoices_pk PRIMARY KEY (invoice_id);


--
-- Name: invoices_products invoices_products_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.invoices_products
    ADD CONSTRAINT invoices_products_pk PRIMARY KEY (invoice_id, product_id, remission_id);


--
-- Name: lines_machines lines_machines_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.lines_machines
    ADD CONSTRAINT lines_machines_pk PRIMARY KEY (line_id, machine_id);


--
-- Name: lines lines_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.lines
    ADD CONSTRAINT lines_pk PRIMARY KEY (line_id);


--
-- Name: machines machines_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.machines
    ADD CONSTRAINT machines_pk PRIMARY KEY (machine_id);


--
-- Name: operators operators_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.operators
    ADD CONSTRAINT operators_pk PRIMARY KEY (operator_id);


--
-- Name: preproducts preproducts_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.preproducts
    ADD CONSTRAINT preproducts_pk PRIMARY KEY (preproduct_id);


--
-- Name: products_status product_status_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products_status
    ADD CONSTRAINT product_status_pk PRIMARY KEY (product_status_id);


--
-- Name: products_inputs products_inputs_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products_inputs
    ADD CONSTRAINT products_inputs_pk PRIMARY KEY (product_id, input_id);


--
-- Name: products products_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products
    ADD CONSTRAINT products_pk PRIMARY KEY (product_id);


--
-- Name: products_technical_data products_technical_data_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products_technical_data
    ADD CONSTRAINT products_technical_data_pk PRIMARY KEY (product_id);


--
-- Name: remissions remissions_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.remissions
    ADD CONSTRAINT remissions_pk PRIMARY KEY (remission_id);


--
-- Name: remissions_products remissions_products_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.remissions_products
    ADD CONSTRAINT remissions_products_pk PRIMARY KEY (remission_id, product_id);


--
-- Name: returns returns_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.returns
    ADD CONSTRAINT returns_pk PRIMARY KEY (return_id);


--
-- Name: returns_products returns_products_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.returns_products
    ADD CONSTRAINT returns_products_pk PRIMARY KEY (return_id, product_id, remission_id);


--
-- Name: sale_order_status sale_order_status_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_order_status
    ADD CONSTRAINT sale_order_status_pk PRIMARY KEY (sale_order_status_id);


--
-- Name: sale_orders_categories sale_orders_categories_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders_categories
    ADD CONSTRAINT sale_orders_categories_pk PRIMARY KEY (sale_order_id, category_id);


--
-- Name: sale_orders sale_orders_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders
    ADD CONSTRAINT sale_orders_pk PRIMARY KEY (sale_order_id);


--
-- Name: suppliers supplier_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.suppliers
    ADD CONSTRAINT supplier_pk PRIMARY KEY (supplier_id);


--
-- Name: turn_incidents turn_incidents_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turn_incidents
    ADD CONSTRAINT turn_incidents_pk PRIMARY KEY (turn_incident_id);


--
-- Name: turn_types turn_types_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turn_types
    ADD CONSTRAINT turn_types_pk PRIMARY KEY (turn_type_id);


--
-- Name: turns_operators turns_operators_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns_operators
    ADD CONSTRAINT turns_operators_pk PRIMARY KEY (turn_id, operator_id);


--
-- Name: turns turns_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns
    ADD CONSTRAINT turns_pk PRIMARY KEY (turn_id);


--
-- Name: units_measure units_measure_pk; Type: CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.units_measure
    ADD CONSTRAINT units_measure_pk PRIMARY KEY (standar_code);


--
-- Name: addresses addresses_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.addresses
    ADD CONSTRAINT addresses_fk FOREIGN KEY (country_id) REFERENCES public.countries(country_id);


--
-- Name: addresses addresses_fk_1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.addresses
    ADD CONSTRAINT addresses_fk_1 FOREIGN KEY (client_id) REFERENCES public.clients(client_id);


--
-- Name: categories categories_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.categories
    ADD CONSTRAINT categories_fk FOREIGN KEY (standar_code) REFERENCES public.units_measure(standar_code);


--
-- Name: incidents_id incidents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.incidents_id
    ADD CONSTRAINT incidents_id_fk FOREIGN KEY (turn_incidents_id) REFERENCES public.turn_incidents(turn_incident_id);


--
-- Name: input_types input_types_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.input_types
    ADD CONSTRAINT input_types_fk FOREIGN KEY (standar_code) REFERENCES public.units_measure(standar_code);


--
-- Name: inputs inputs_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.inputs
    ADD CONSTRAINT inputs_fk FOREIGN KEY (standar_code) REFERENCES public.units_measure(standar_code);


--
-- Name: inputs inputs_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.inputs
    ADD CONSTRAINT inputs_fk1 FOREIGN KEY (supplier_id) REFERENCES public.suppliers(supplier_id);


--
-- Name: inputs inputs_fk2; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.inputs
    ADD CONSTRAINT inputs_fk2 FOREIGN KEY (input_type_id) REFERENCES public.input_types(input_type_id);


--
-- Name: invoices invoices_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.invoices
    ADD CONSTRAINT invoices_fk FOREIGN KEY (client_id) REFERENCES public.clients(client_id);


--
-- Name: lines_machines lines_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.lines_machines
    ADD CONSTRAINT lines_fk FOREIGN KEY (line_id) REFERENCES public.lines(line_id);


--
-- Name: lines_machines machines_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.lines_machines
    ADD CONSTRAINT machines_fk FOREIGN KEY (machine_id) REFERENCES public.machines(machine_id);


--
-- Name: preproducts preproducts_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.preproducts
    ADD CONSTRAINT preproducts_fk1 FOREIGN KEY (turn_id) REFERENCES public.turns(turn_id);


--
-- Name: preproducts preproducts_fk2; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.preproducts
    ADD CONSTRAINT preproducts_fk2 FOREIGN KEY (standar_code) REFERENCES public.units_measure(standar_code);


--
-- Name: products products_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products
    ADD CONSTRAINT products_fk FOREIGN KEY (sale_order_id) REFERENCES public.sale_orders(sale_order_id);


--
-- Name: products products_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products
    ADD CONSTRAINT products_fk1 FOREIGN KEY (category_id) REFERENCES public.categories(category_id);


--
-- Name: products products_fk3; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products
    ADD CONSTRAINT products_fk3 FOREIGN KEY (product_status_id) REFERENCES public.products_status(product_status_id);


--
-- Name: products products_fk4; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products
    ADD CONSTRAINT products_fk4 FOREIGN KEY (turn_id) REFERENCES public.turns(turn_id);


--
-- Name: products products_fk5; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products
    ADD CONSTRAINT products_fk5 FOREIGN KEY (supplier_id) REFERENCES public.suppliers(supplier_id);


--
-- Name: products_inputs products_inputs_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products_inputs
    ADD CONSTRAINT products_inputs_fk FOREIGN KEY (input_id) REFERENCES public.inputs(input_id);


--
-- Name: products_inputs products_inputs_fk_1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products_inputs
    ADD CONSTRAINT products_inputs_fk_1 FOREIGN KEY (product_id) REFERENCES public.products(product_id);


--
-- Name: products_technical_data products_technical_data_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.products_technical_data
    ADD CONSTRAINT products_technical_data_fk FOREIGN KEY (product_id) REFERENCES public.products(product_id);


--
-- Name: remissions remissions_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.remissions
    ADD CONSTRAINT remissions_fk FOREIGN KEY (client_id) REFERENCES public.clients(client_id);


--
-- Name: remissions remissions_fk_1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.remissions
    ADD CONSTRAINT remissions_fk_1 FOREIGN KEY (address_id) REFERENCES public.addresses(address_id);


--
-- Name: returns returns_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.returns
    ADD CONSTRAINT returns_fk FOREIGN KEY (client_id) REFERENCES public.clients(client_id);


--
-- Name: sale_orders_categories sale_orders_categories_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders_categories
    ADD CONSTRAINT sale_orders_categories_fk1 FOREIGN KEY (sale_order_id) REFERENCES public.sale_orders(sale_order_id);


--
-- Name: sale_orders_categories sale_orders_categories_fk2; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders_categories
    ADD CONSTRAINT sale_orders_categories_fk2 FOREIGN KEY (category_id) REFERENCES public.categories(category_id);


--
-- Name: sale_orders sale_orders_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders
    ADD CONSTRAINT sale_orders_fk1 FOREIGN KEY (client_id) REFERENCES public.clients(client_id);


--
-- Name: sale_orders sale_orders_fk2; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders
    ADD CONSTRAINT sale_orders_fk2 FOREIGN KEY (delivery_type_id) REFERENCES public.delivery_types(delivery_type_id);


--
-- Name: sale_orders sale_orders_fk3; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.sale_orders
    ADD CONSTRAINT sale_orders_fk3 FOREIGN KEY (sale_order_status_id) REFERENCES public.sale_order_status(sale_order_status_id);


--
-- Name: suppliers_input_types suppliers_input_types_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.suppliers_input_types
    ADD CONSTRAINT suppliers_input_types_fk1 FOREIGN KEY (supplier_id) REFERENCES public.suppliers(supplier_id);


--
-- Name: suppliers_input_types suppliers_input_types_fk2; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.suppliers_input_types
    ADD CONSTRAINT suppliers_input_types_fk2 FOREIGN KEY (input_type_id) REFERENCES public.input_types(input_type_id);


--
-- Name: turn_incidents turn_incidents_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turn_incidents
    ADD CONSTRAINT turn_incidents_fk FOREIGN KEY (turn_id) REFERENCES public.turns(turn_id);


--
-- Name: turns turns_lines_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns
    ADD CONSTRAINT turns_lines_fk FOREIGN KEY (line_id) REFERENCES public.lines(line_id);


--
-- Name: turns_operators turns_operators_fk1; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns_operators
    ADD CONSTRAINT turns_operators_fk1 FOREIGN KEY (turn_id) REFERENCES public.turns(turn_id);


--
-- Name: turns_operators turns_operators_fk2; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns_operators
    ADD CONSTRAINT turns_operators_fk2 FOREIGN KEY (operator_id) REFERENCES public.operators(operator_id);


--
-- Name: turns turns_types_fk; Type: FK CONSTRAINT; Schema: public; Owner: factorytrace
--

ALTER TABLE ONLY public.turns
    ADD CONSTRAINT turns_types_fk FOREIGN KEY (turn_type_id) REFERENCES public.turn_types(turn_type_id);


--
-- PostgreSQL database dump complete
--

\unrestrict grExcFIolufdUjz4hXW9CjHHt3zfzTpTl9JUsa87JnMRjZtCNiqgyMCaA7SENuZ

