--
--



--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: 
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: 
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';




--
-- Name: achat; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.achat (
    id integer NOT NULL,
    quantite integer,
    intrant integer,
    fournisseur integer,
    url_piece_jointe character varying(255),
    date date,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    prix_unitaire integer,
    prix_total integer,
    user_id integer
);


ALTER TABLE public.achat OWNER TO postgres;

--
-- Name: achat_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.achat_id_seq OWNER TO postgres;

--
-- Name: achat_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.achat_id_seq OWNED BY public.achat.id;


--
-- Name: categorie; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.categorie (
    id integer NOT NULL,
    nom character varying(254) NOT NULL,
    description character varying(254),
    actif boolean DEFAULT true NOT NULL,
    user_id integer
);


ALTER TABLE public.categorie OWNER TO postgres;

--
-- Name: categorie_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.categorie_id_seq OWNER TO postgres;

--
-- Name: categorie_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.categorie_id_seq OWNED BY public.categorie.id;


--
-- Name: client; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.client (
    id integer NOT NULL,
    nom character varying(255),
    prenoms character varying(255),
    telephone character varying(255),
    email character varying(255),
    date_inscription date,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    user_id integer
);


ALTER TABLE public.client OWNER TO postgres;

--
-- Name: client_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.client_id_seq OWNER TO postgres;

--
-- Name: client_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.client_id_seq OWNED BY public.client.id;


--
-- Name: don; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.don (
    id integer NOT NULL,
    produit integer,
    quantite integer,
    beneficiaire character varying(255),
    date date,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    user_id integer
);


ALTER TABLE public.don OWNER TO postgres;

--
-- Name: don_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.don_id_seq OWNER TO postgres;

--
-- Name: don_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.don_id_seq OWNED BY public.don.id;


--
-- Name: fournisseur; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.fournisseur (
    id integer NOT NULL,
    nom character varying(255),
    telephone character varying(255),
    email character varying(255),
    date_inscription date,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    user_id integer
);


ALTER TABLE public.fournisseur OWNER TO postgres;

--
-- Name: fournisseur_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.fournisseur_id_seq OWNER TO postgres;

--
-- Name: fournisseur_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.fournisseur_id_seq OWNED BY public.fournisseur.id;


--
-- Name: intrant; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.intrant (
    id integer NOT NULL,
    designation character varying(255),
    stock integer,
    seuil integer,
    unite character varying(255),
    prix_achat integer,
    service integer,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    user_id integer
);


ALTER TABLE public.intrant OWNER TO postgres;

--
-- Name: intrant_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.intrant_id_seq OWNER TO postgres;

--
-- Name: intrant_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.intrant_id_seq OWNED BY public.intrant.id;


--
-- Name: intrant_service; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.intrant_service (
    id integer NOT NULL,
    quantite integer,
    service integer,
    intrant integer,
    date date,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    user_id integer
);


ALTER TABLE public.intrant_service OWNER TO postgres;

--
-- Name: intrant_service_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.intrant_service_id_seq OWNER TO postgres;

--
-- Name: intrant_service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.intrant_service_id_seq OWNED BY public.intrant_service.id;


--
-- Name: piece; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.piece (
    id integer NOT NULL,
    nom character varying(255),
    url_piece_jointe character varying(255),
    service integer,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    prix integer,
    user_id integer
);


ALTER TABLE public.piece OWNER TO postgres;

--
-- Name: piece_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.piece_id_seq OWNER TO postgres;

--
-- Name: piece_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.piece_id_seq OWNED BY public.piece.id;


--
-- Name: produit; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.produit (
    id integer NOT NULL,
    designation character varying(255),
    stock integer,
    seuil integer,
    unite character varying(255),
    prix_de_vente integer,
    categorie integer,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    user_id integer
);


ALTER TABLE public.produit OWNER TO postgres;

--
-- Name: produit_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.produit_id_seq OWNER TO postgres;

--
-- Name: produit_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.produit_id_seq OWNED BY public.produit.id;


--
-- Name: profil; Type: TABLE; Schema: public; Owner: stock
--

CREATE TABLE public.profil (
    id integer,
    label character varying(255)
);


ALTER TABLE public.profil OWNER TO stock;

--
-- Name: service; Type: TABLE; Schema: public; Owner: stock
--

CREATE TABLE public.service (
    id integer NOT NULL,
    nom character varying(255),
    description character varying(255),
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    actif boolean DEFAULT true,
    user_id integer
);


ALTER TABLE public.service OWNER TO stock;

--
-- Name: service_id_seq; Type: SEQUENCE; Schema: public; Owner: stock
--

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


ALTER TABLE public.service_id_seq OWNER TO stock;

--
-- Name: service_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: stock
--

ALTER SEQUENCE public.service_id_seq OWNED BY public.service.id;

--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: stock
--

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


ALTER TABLE public.users_id_seq OWNER TO stock;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: stock
--

ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;


--
-- Name: vente; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.vente (
    id integer NOT NULL,
    quantite integer,
    produit integer,
    client integer,
    url_piece_jointe character varying(255),
    date date,
    created_at date DEFAULT now(),
    updated_at date DEFAULT now(),
    commentaire text,
    prix_unitaire integer,
    prix_total integer,
    user_id integer
);


ALTER TABLE public.vente OWNER TO postgres;

--
-- Name: vente_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--

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


ALTER TABLE public.vente_id_seq OWNER TO postgres;

--
-- Name: vente_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--

ALTER SEQUENCE public.vente_id_seq OWNED BY public.vente.id;


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


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

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


--
-- Data for Name: achat; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.achat (id, quantite, intrant, fournisseur, url_piece_jointe, date, created_at, updated_at, prix_unitaire, prix_total, user_id) FROM stdin;
6	10	3	2	achat_05d1b210-5b2f-11e9-8415-5f9f5d4f966a.pdf	2019-04-01	2019-04-10	2019-04-10	50000	500000	1
\.



--
-- Data for Name: categorie; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.categorie (id, nom, description, actif, user_id) FROM stdin;
1	Fruits et Légumes	\N	t	1
2	Viandes	\N	t	1
3	Lait	\N	t	1
\.



--
-- Data for Name: client; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.client (id, nom, prenoms, telephone, email, date_inscription, created_at, updated_at, actif, user_id) FROM stdin;
2	Hassan	BA	+221 77 777 7777	hassanba@gmail.com	\N	2019-04-09	2019-04-09	t	1
\.



--
-- Data for Name: don; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.don (id, produit, quantite, beneficiaire, date, created_at, updated_at, user_id) FROM stdin;
2	2	50	Ministère de l'élevage	2019-04-02	2019-04-11	2019-04-11	1
\.



--
-- Data for Name: fournisseur; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.fournisseur (id, nom, telephone, email, date_inscription, created_at, updated_at, actif, user_id) FROM stdin;
2	SEDIMA	+221 88 888 8888	contact@sedima.sn	\N	2019-04-09	2019-04-09	t	1
\.



--
-- Data for Name: intrant; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.intrant (id, designation, stock, seuil, unite, prix_achat, service, created_at, updated_at, actif, user_id) FROM stdin;
3	engrais	175	1	tonnes	50000	2	2019-04-09	2019-04-09	t	1
4	Blé	500000	5	tonnes	20000	2	2019-04-15	2019-04-15	t	1
\.



--
-- Data for Name: intrant_service; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.intrant_service (id, quantite, service, intrant, date, created_at, updated_at, actif, user_id) FROM stdin;
\.



--
-- Data for Name: piece; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.piece (id, nom, url_piece_jointe, service, created_at, updated_at, actif, prix, user_id) FROM stdin;
3	test 2	piece_df131090-5ae5-11e9-8baf-2f78b48bf03c.pdf	4	2019-04-09	2019-04-09	t	456	1
\.



--
-- Data for Name: produit; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.produit (id, designation, stock, seuil, unite, prix_de_vente, categorie, created_at, updated_at, actif, user_id) FROM stdin;
2	carottes	9356	50	kg	100	1	2019-04-09	2019-04-09	t	1
\.



--
-- Data for Name: profil; Type: TABLE DATA; Schema: public; Owner: stock
--

COPY public.profil (id, label) FROM stdin;
1	Gérant
2	Responsable Administratif et Financier
3	Responsable exploitation
4	Responsable Technique
5	Responsable commercial
6	Assistant gérant
\.


--
-- Data for Name: service; Type: TABLE DATA; Schema: public; Owner: stock
--

COPY public.service (id, nom, description, created_at, updated_at, actif, user_id) FROM stdin;
1	Service Technique	\N	2019-03-26	2019-03-26	t	1
2	Service Exploitation	\N	2019-03-26	2019-03-26	t	1
3	Service Administratif et Financier	\N	2019-04-04	2019-04-04	t	1
4	Service Communication	\N	2019-04-04	2019-04-04	t	1
5	Manager	\N	2019-04-04	2019-04-04	t	1
\.



--
-- Data for Name: vente; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.vente (id, quantite, produit, client, url_piece_jointe, date, created_at, updated_at, commentaire, prix_unitaire, prix_total, user_id) FROM stdin;
5	544	2	2	vente_f872ff20-5b2e-11e9-8415-5f9f5d4f966a.pdf	2019-02-05	2019-04-10	2019-04-10	\N	100	54400	1
\.



--
-- Name: achat_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.achat
    ADD CONSTRAINT achat_pkey PRIMARY KEY (id);


--
-- Name: categorie_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.categorie
    ADD CONSTRAINT categorie_pkey PRIMARY KEY (id);


--
-- Name: client_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.client
    ADD CONSTRAINT client_pkey PRIMARY KEY (id);


--
-- Name: don_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.don
    ADD CONSTRAINT don_pkey PRIMARY KEY (id);


--
-- Name: fournisseur_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.fournisseur
    ADD CONSTRAINT fournisseur_pkey PRIMARY KEY (id);


--
-- Name: intrant_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant
    ADD CONSTRAINT intrant_pkey PRIMARY KEY (id);


--
-- Name: intrant_service_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant_service
    ADD CONSTRAINT intrant_service_pkey PRIMARY KEY (id);


--
-- Name: piece_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.piece
    ADD CONSTRAINT piece_pkey PRIMARY KEY (id);


--
-- Name: produit_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.produit
    ADD CONSTRAINT produit_pkey PRIMARY KEY (id);


--
-- Name: service_pkey; Type: CONSTRAINT; Schema: public; Owner: stock
--

ALTER TABLE ONLY public.service
    ADD CONSTRAINT service_pkey PRIMARY KEY (id);


--
-- Name: vente_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.vente
    ADD CONSTRAINT vente_pkey PRIMARY KEY (id);


--
-- Name: achat_fournisseur_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.achat
    ADD CONSTRAINT achat_fournisseur_fkey FOREIGN KEY (fournisseur) REFERENCES public.fournisseur(id);


--
-- Name: achat_intrant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.achat
    ADD CONSTRAINT achat_intrant_fkey FOREIGN KEY (intrant) REFERENCES public.intrant(id);


--
-- Name: don_produit_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.don
    ADD CONSTRAINT don_produit_fkey FOREIGN KEY (produit) REFERENCES public.produit(id);


--
-- Name: fk_achat_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.achat
    ADD CONSTRAINT fk_achat_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_categorie_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.categorie
    ADD CONSTRAINT fk_categorie_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_client_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.client
    ADD CONSTRAINT fk_client_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_don_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.don
    ADD CONSTRAINT fk_don_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_fournisseur_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.fournisseur
    ADD CONSTRAINT fk_fournisseur_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_intrant_service_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant_service
    ADD CONSTRAINT fk_intrant_service_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_intrant_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant
    ADD CONSTRAINT fk_intrant_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_piece_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.piece
    ADD CONSTRAINT fk_piece_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_produit_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.produit
    ADD CONSTRAINT fk_produit_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_service_user; Type: FK CONSTRAINT; Schema: public; Owner: stock
--

ALTER TABLE ONLY public.service
    ADD CONSTRAINT fk_service_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: fk_vente_user; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.vente
    ADD CONSTRAINT fk_vente_user FOREIGN KEY (user_id) REFERENCES public.users(id);


--
-- Name: intrant_service_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant
    ADD CONSTRAINT intrant_service_fkey FOREIGN KEY (service) REFERENCES public.service(id);


--
-- Name: intrant_service_intrant_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant_service
    ADD CONSTRAINT intrant_service_intrant_fkey FOREIGN KEY (intrant) REFERENCES public.intrant(id);


--
-- Name: intrant_service_service_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.intrant_service
    ADD CONSTRAINT intrant_service_service_fkey FOREIGN KEY (service) REFERENCES public.service(id);


--
-- Name: piece_service_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.piece
    ADD CONSTRAINT piece_service_fkey FOREIGN KEY (service) REFERENCES public.service(id);


--
-- Name: produit_categorie_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.produit
    ADD CONSTRAINT produit_categorie_fkey FOREIGN KEY (categorie) REFERENCES public.categorie(id);


--
-- Name: vente_client_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.vente
    ADD CONSTRAINT vente_client_fkey FOREIGN KEY (client) REFERENCES public.client(id);


--
-- Name: vente_produit_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.vente
    ADD CONSTRAINT vente_produit_fkey FOREIGN KEY (produit) REFERENCES public.produit(id);


--
-- Name: SCHEMA public; Type: ACL; Schema: -; Owner: postgres
--

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;


--
--

