--
-- PostgreSQL database dump
--

-- Dumped from database version 11.20 (Ubuntu 11.20-1.pgdg20.04+1)
-- Dumped by pg_dump version 12.15 (Ubuntu 12.15-1.pgdg20.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: minierp; Type: SCHEMA; Schema: -; Owner: jfaria
--

CREATE SCHEMA minierp;


ALTER SCHEMA minierp OWNER TO jfaria;

SET default_tablespace = '';

--
-- Name: corders; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.corders (
    id integer NOT NULL,
    customer_id integer,
    product_id integer,
    qt integer,
    weekp integer,
    weekd integer,
    status character varying
);


ALTER TABLE minierp.corders OWNER TO jfaria;

--
-- Name: COLUMN corders.weekp; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.corders.weekp IS 'week planned:week entered in the customer orders management module';


--
-- Name: COLUMN corders.weekd; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.corders.weekd IS 'week done: after execution of the corresponding expedition order by the MES';


--
-- Name: COLUMN corders.status; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.corders.status IS 'accepted: after creation of the order in the customer orders module; planned: after the creation of the corresponding expedition order by the planning module; done: after the execution of the order by the MES; canceled: after cancel in the customer orders management interface';


--
-- Name: customerorders_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.customerorders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.customerorders_id_seq OWNER TO jfaria;

--
-- Name: customerorders_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.customerorders_id_seq OWNED BY minierp.corders.id;


--
-- Name: customers; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.customers (
    id integer NOT NULL,
    name character varying NOT NULL
);


ALTER TABLE minierp.customers OWNER TO jfaria;

--
-- Name: customers_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.customers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.customers_id_seq OWNER TO jfaria;

--
-- Name: customers_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.customers_id_seq OWNED BY minierp.customers.id;


--
-- Name: eorders; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.eorders (
    id integer NOT NULL,
    corder_id integer,
    qt integer,
    weekp integer,
    weekd integer,
    status character varying
);


ALTER TABLE minierp.eorders OWNER TO jfaria;

--
-- Name: COLUMN eorders.weekp; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.eorders.weekp IS 'week planned by the ERP';


--
-- Name: COLUMN eorders.weekd; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.eorders.weekd IS 'week done, updated by the MES after the execution of the order';


--
-- Name: COLUMN eorders.status; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.eorders.status IS 'planned: after creation by the planning module of the ERP; done: after execution by the MES';


--
-- Name: expeditionorders_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.expeditionorders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.expeditionorders_id_seq OWNER TO jfaria;

--
-- Name: expeditionorders_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.expeditionorders_id_seq OWNED BY minierp.eorders.id;


--
-- Name: materials; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.materials (
    id integer NOT NULL,
    name character varying NOT NULL,
    inventory integer,
    sstock integer
);


ALTER TABLE minierp.materials OWNER TO jfaria;

--
-- Name: COLUMN materials.sstock; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.materials.sstock IS 'safety stock level';


--
-- Name: materials_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.materials_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.materials_id_seq OWNER TO jfaria;

--
-- Name: materials_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.materials_id_seq OWNED BY minierp.materials.id;


--
-- Name: porders; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.porders (
    id integer NOT NULL,
    product_id integer,
    qtp integer,
    qtok integer,
    weekp integer,
    weekd integer,
    status character varying
);


ALTER TABLE minierp.porders OWNER TO jfaria;

--
-- Name: COLUMN porders.qtp; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.porders.qtp IS 'qtp: number of products to be produced planned by the ERP';


--
-- Name: COLUMN porders.qtok; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.porders.qtok IS 'qtok: number of products produced that passed the quality control (you can ignore this column)';


--
-- Name: COLUMN porders.weekp; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.porders.weekp IS 'week planned by the ERP';


--
-- Name: COLUMN porders.weekd; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.porders.weekd IS 'week done, set by the MES after the execution of the order';


--
-- Name: COLUMN porders.status; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.porders.status IS 'planned: after creation by the planning module of the ERP; done: after execution by the MES';


--
-- Name: productionorders_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.productionorders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.productionorders_id_seq OWNER TO jfaria;

--
-- Name: productionorders_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.productionorders_id_seq OWNED BY minierp.porders.id;


--
-- Name: products; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.products (
    id integer NOT NULL,
    name character varying NOT NULL,
    inventory integer,
    material_id integer
);


ALTER TABLE minierp.products OWNER TO jfaria;

--
-- Name: products_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.products_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.products_id_seq OWNER TO jfaria;

--
-- Name: products_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.products_id_seq OWNED BY minierp.products.id;


--
-- Name: sorders; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.sorders (
    id integer NOT NULL,
    material_id integer,
    supplier_id integer,
    qt integer NOT NULL,
    weekp integer,
    weekd integer,
    status character varying
);


ALTER TABLE minierp.sorders OWNER TO jfaria;

--
-- Name: COLUMN sorders.weekp; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.sorders.weekp IS 'week planned by the ERP';


--
-- Name: COLUMN sorders.weekd; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.sorders.weekd IS 'week done, update by th eMES after the inbound to the warehouse';


--
-- Name: COLUMN sorders.status; Type: COMMENT; Schema: minierp; Owner: jfaria
--

COMMENT ON COLUMN minierp.sorders.status IS 'planned: after creation by the planning module of the ERP; done: after execution by the MES of teh inbound to the warehouse';


--
-- Name: supplierorders_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.supplierorders_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.supplierorders_id_seq OWNER TO jfaria;

--
-- Name: supplierorders_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.supplierorders_id_seq OWNED BY minierp.sorders.id;


--
-- Name: supplierorders_qt_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.supplierorders_qt_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.supplierorders_qt_seq OWNER TO jfaria;

--
-- Name: supplierorders_qt_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.supplierorders_qt_seq OWNED BY minierp.sorders.qt;


--
-- Name: suppliers; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.suppliers (
    id integer NOT NULL,
    name character varying NOT NULL
);


ALTER TABLE minierp.suppliers OWNER TO jfaria;

--
-- Name: suppliers_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.suppliers_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.suppliers_id_seq OWNER TO jfaria;

--
-- Name: suppliers_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.suppliers_id_seq OWNED BY minierp.suppliers.id;


--
-- Name: weeks; Type: TABLE; Schema: minierp; Owner: jfaria
--

CREATE TABLE minierp.weeks (
    id integer NOT NULL,
    year integer,
    nr integer NOT NULL,
    friday character varying NOT NULL
);


ALTER TABLE minierp.weeks OWNER TO jfaria;

--
-- Name: weeks_id_seq; Type: SEQUENCE; Schema: minierp; Owner: jfaria
--

CREATE SEQUENCE minierp.weeks_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE minierp.weeks_id_seq OWNER TO jfaria;

--
-- Name: weeks_id_seq; Type: SEQUENCE OWNED BY; Schema: minierp; Owner: jfaria
--

ALTER SEQUENCE minierp.weeks_id_seq OWNED BY minierp.weeks.id;


--
-- Name: corders id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.corders ALTER COLUMN id SET DEFAULT nextval('minierp.customerorders_id_seq'::regclass);


--
-- Name: customers id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.customers ALTER COLUMN id SET DEFAULT nextval('minierp.customers_id_seq'::regclass);


--
-- Name: eorders id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.eorders ALTER COLUMN id SET DEFAULT nextval('minierp.expeditionorders_id_seq'::regclass);


--
-- Name: materials id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.materials ALTER COLUMN id SET DEFAULT nextval('minierp.materials_id_seq'::regclass);


--
-- Name: porders id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.porders ALTER COLUMN id SET DEFAULT nextval('minierp.productionorders_id_seq'::regclass);


--
-- Name: products id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.products ALTER COLUMN id SET DEFAULT nextval('minierp.products_id_seq'::regclass);


--
-- Name: suppliers id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.suppliers ALTER COLUMN id SET DEFAULT nextval('minierp.suppliers_id_seq'::regclass);


--
-- Name: weeks id; Type: DEFAULT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.weeks ALTER COLUMN id SET DEFAULT nextval('minierp.weeks_id_seq'::regclass);


--
-- Data for Name: corders; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--

INSERT INTO minierp.corders VALUES (3, 1, 4, 2, 6, NULL, 'accepted');
INSERT INTO minierp.corders VALUES (2, 1, 4, 3, 6, NULL, 'accepted');
INSERT INTO minierp.corders VALUES (4, 1, 4, 5, 6, NULL, 'accepted');


--
-- Data for Name: customers; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--

INSERT INTO minierp.customers VALUES (1, 'Digicert');
INSERT INTO minierp.customers VALUES (2, 'Arxa');
INSERT INTO minierp.customers VALUES (3, 'Texpress');
INSERT INTO minierp.customers VALUES (4, 'Totally
');


--
-- Data for Name: eorders; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--



--
-- Data for Name: materials; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--

INSERT INTO minierp.materials VALUES (1, 'Blue', 3, 8);
INSERT INTO minierp.materials VALUES (2, 'Green', 4, 7);


--
-- Data for Name: porders; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--



--
-- Data for Name: products; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--

INSERT INTO minierp.products VALUES (4, 'Base blue', 40, 1);
INSERT INTO minierp.products VALUES (5, 'Base green', 7, 2);
INSERT INTO minierp.products VALUES (7, 'Lead blue', 3, 1);
INSERT INTO minierp.products VALUES (8, 'Lead green', 6, 2);


--
-- Data for Name: sorders; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--



--
-- Data for Name: suppliers; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--

INSERT INTO minierp.suppliers VALUES (1, 'Fitex');
INSERT INTO minierp.suppliers VALUES (2, 'Rawplus');


--
-- Data for Name: weeks; Type: TABLE DATA; Schema: minierp; Owner: jfaria
--

INSERT INTO minierp.weeks VALUES (1, 2021, 4, '29-Jan');
INSERT INTO minierp.weeks VALUES (2, 2021, 5, '5-Fev');
INSERT INTO minierp.weeks VALUES (3, 2021, 6, '12-Fev');
INSERT INTO minierp.weeks VALUES (4, 2021, 7, '19-Fev');
INSERT INTO minierp.weeks VALUES (5, 2021, 8, '26-Fev');
INSERT INTO minierp.weeks VALUES (6, 2021, 9, '5-Mar');
INSERT INTO minierp.weeks VALUES (7, 2021, 10, '12-Mar');
INSERT INTO minierp.weeks VALUES (8, 2021, 11, '19-Mar');
INSERT INTO minierp.weeks VALUES (9, 2021, 12, '26-Mar');
INSERT INTO minierp.weeks VALUES (10, 2021, 13, '2-Apr');
INSERT INTO minierp.weeks VALUES (11, 2021, 14, '9-Apr');
INSERT INTO minierp.weeks VALUES (12, 2021, 15, '19-Apr');
INSERT INTO minierp.weeks VALUES (13, 2021, 1, '8-jan');
INSERT INTO minierp.weeks VALUES (14, 2021, 2, '15-jan');
INSERT INTO minierp.weeks VALUES (15, 2021, 3, '22-jan');


--
-- Name: customerorders_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.customerorders_id_seq', 4, true);


--
-- Name: customers_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.customers_id_seq', 1, false);


--
-- Name: expeditionorders_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.expeditionorders_id_seq', 337, true);


--
-- Name: materials_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.materials_id_seq', 1, false);


--
-- Name: productionorders_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.productionorders_id_seq', 1, false);


--
-- Name: products_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.products_id_seq', 1, false);


--
-- Name: supplierorders_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.supplierorders_id_seq', 10, true);


--
-- Name: supplierorders_qt_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.supplierorders_qt_seq', 1, true);


--
-- Name: suppliers_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.suppliers_id_seq', 1, false);


--
-- Name: weeks_id_seq; Type: SEQUENCE SET; Schema: minierp; Owner: jfaria
--

SELECT pg_catalog.setval('minierp.weeks_id_seq', 1, true);


--
-- Name: corders customerorders_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.corders
    ADD CONSTRAINT customerorders_pkey PRIMARY KEY (id);


--
-- Name: customers customers_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.customers
    ADD CONSTRAINT customers_pkey PRIMARY KEY (id);


--
-- Name: eorders expeditionorders_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.eorders
    ADD CONSTRAINT expeditionorders_pkey PRIMARY KEY (id);


--
-- Name: materials materials_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.materials
    ADD CONSTRAINT materials_pkey PRIMARY KEY (id);


--
-- Name: porders productionorders_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.porders
    ADD CONSTRAINT productionorders_pkey PRIMARY KEY (id);


--
-- Name: products products_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.products
    ADD CONSTRAINT products_pkey PRIMARY KEY (id);


--
-- Name: sorders sorders_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.sorders
    ADD CONSTRAINT sorders_pkey PRIMARY KEY (id);


--
-- Name: suppliers suppliers_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.suppliers
    ADD CONSTRAINT suppliers_pkey PRIMARY KEY (id);


--
-- Name: weeks weeks_nr_key; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.weeks
    ADD CONSTRAINT weeks_nr_key UNIQUE (nr);


--
-- Name: weeks weeks_pkey; Type: CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.weeks
    ADD CONSTRAINT weeks_pkey PRIMARY KEY (id);


--
-- Name: corders customerorders_customer_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.corders
    ADD CONSTRAINT customerorders_customer_id_fkey FOREIGN KEY (customer_id) REFERENCES minierp.customers(id);


--
-- Name: corders customerorders_product_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.corders
    ADD CONSTRAINT customerorders_product_id_fkey FOREIGN KEY (product_id) REFERENCES minierp.products(id);


--
-- Name: corders customerorders_weekd_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.corders
    ADD CONSTRAINT customerorders_weekd_fkey FOREIGN KEY (weekd) REFERENCES minierp.weeks(nr);


--
-- Name: corders customerorders_weekp_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.corders
    ADD CONSTRAINT customerorders_weekp_fkey FOREIGN KEY (weekp) REFERENCES minierp.weeks(nr);


--
-- Name: eorders expeditionorders_custorder_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.eorders
    ADD CONSTRAINT expeditionorders_custorder_id_fkey FOREIGN KEY (corder_id) REFERENCES minierp.corders(id);


--
-- Name: eorders expeditionorders_weekd_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.eorders
    ADD CONSTRAINT expeditionorders_weekd_fkey FOREIGN KEY (weekd) REFERENCES minierp.weeks(nr);


--
-- Name: eorders expeditionorders_weekp_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.eorders
    ADD CONSTRAINT expeditionorders_weekp_fkey FOREIGN KEY (weekp) REFERENCES minierp.weeks(nr);


--
-- Name: porders productionorders_product_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.porders
    ADD CONSTRAINT productionorders_product_id_fkey FOREIGN KEY (product_id) REFERENCES minierp.products(id);


--
-- Name: porders productionorders_weekd_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.porders
    ADD CONSTRAINT productionorders_weekd_fkey FOREIGN KEY (weekd) REFERENCES minierp.weeks(nr);


--
-- Name: porders productionorders_weekp_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.porders
    ADD CONSTRAINT productionorders_weekp_fkey FOREIGN KEY (weekp) REFERENCES minierp.weeks(nr);


--
-- Name: products products_material_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.products
    ADD CONSTRAINT products_material_id_fkey FOREIGN KEY (material_id) REFERENCES minierp.materials(id);


--
-- Name: sorders sorders_material_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.sorders
    ADD CONSTRAINT sorders_material_id_fkey FOREIGN KEY (material_id) REFERENCES minierp.materials(id);


--
-- Name: sorders sorders_supplier_id_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.sorders
    ADD CONSTRAINT sorders_supplier_id_fkey FOREIGN KEY (supplier_id) REFERENCES minierp.suppliers(id);


--
-- Name: sorders sorders_weekd_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.sorders
    ADD CONSTRAINT sorders_weekd_fkey FOREIGN KEY (weekd) REFERENCES minierp.weeks(nr);


--
-- Name: sorders sorders_weekp_fkey; Type: FK CONSTRAINT; Schema: minierp; Owner: jfaria
--

ALTER TABLE ONLY minierp.sorders
    ADD CONSTRAINT sorders_weekp_fkey FOREIGN KEY (weekp) REFERENCES minierp.weeks(nr);


--
-- PostgreSQL database dump complete
--

