-
Notifications
You must be signed in to change notification settings - Fork 3
/
creation_bdpoireau.txt
123 lines (94 loc) · 2.57 KB
/
creation_bdpoireau.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
------------------------------------------------------------
-- Script Postgre
------------------------------------------------------------
-- Table: public.commune
-- DROP TABLE public.commune;
CREATE TABLE public.commune
(
com_code integer NOT NULL,
com_nom character varying(50) NOT NULL,
CONSTRAINT prk_constraint_commune PRIMARY KEY (com_code)
)
WITH (
OIDS=FALSE
);
-- Table: public.jour
-- DROP TABLE public.jour;
CREATE TABLE public.jour
(
jour_id SERIAL NOT NULL ,
jou_date date NOT NULL,
CONSTRAINT prk_constraint_jour PRIMARY KEY (jour_id)
)
WITH (
OIDS=FALSE
);
-- Table: public.produit
-- DROP TABLE public.produit;
CREATE TABLE public.produit
(
pro_id SERIAL NOT NULL ,
pro_nom character varying(30) NOT NULL,
pro_leg boolean,
CONSTRAINT prk_constraint_produit PRIMARY KEY (pro_id)
)
WITH (
OIDS=FALSE
);
-- Table: public.stock
-- DROP TABLE public.stock;
CREATE TABLE public.stock
(
sto_qte double precision NOT NULL,
sto_pert boolean,
spro_id integer NOT NULL,
sjour_id integer NOT NULL,
sto_id SERIAL NOT NULL ,
CONSTRAINT pk_stock PRIMARY KEY (sto_id),
CONSTRAINT fk_stock_jour_id FOREIGN KEY (sjour_id)
REFERENCES public.jour (jour_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_stock_pro_id FOREIGN KEY (spro_id)
REFERENCES public.produit (pro_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
-- Table: public.vente
-- DROP TABLE public.vente;
CREATE TABLE public.vente
(
ven_id SERIAL NOT NULL ,
ven_heur time with time zone NOT NULL,
vcom_code integer,
vjour_id integer,
CONSTRAINT prk_constraint_vente PRIMARY KEY (ven_id),
CONSTRAINT fk_vente_com_code FOREIGN KEY (vcom_code)
REFERENCES public.commune (com_code) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_vente_jour_id FOREIGN KEY (vjour_id)
REFERENCES public.jour (jour_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);
-- Table: public.contenu
-- DROP TABLE public.contenu;
CREATE TABLE public.contenu
(
con_qte double precision NOT NULL,
cven_id integer NOT NULL,
cpro_id integer NOT NULL,
CONSTRAINT prk_constraint_contenu PRIMARY KEY (cven_id, cpro_id),
CONSTRAINT fk_contenu_pro_id FOREIGN KEY (cpro_id)
REFERENCES public.produit (pro_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk_contenu_ven_id FOREIGN KEY (cven_id)
REFERENCES public.vente (ven_id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (
OIDS=FALSE
);