-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgeneratedata.sql
426 lines (299 loc) · 10 KB
/
generatedata.sql
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
--
-- PostgreSQL database dump
--
-- Dumped from database version 11.2
-- Dumped by pg_dump version 11.2
-- Started on 2019-07-02 16:06:52
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 client_min_messages = warning;
SET row_security = off;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- TOC entry 196 (class 1259 OID 16871)
-- Name: person; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.person (
id bigint NOT NULL,
"firstName" character varying NOT NULL,
"lastName" character varying NOT NULL,
email character varying NOT NULL,
"phoneNumber" character varying,
password character varying(15) NOT NULL
);
ALTER TABLE public.person OWNER TO postgres;
--
-- TOC entry 197 (class 1259 OID 16877)
-- Name: Person_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public."Person_id_seq"
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public."Person_id_seq" OWNER TO postgres;
--
-- TOC entry 2862 (class 0 OID 0)
-- Dependencies: 197
-- Name: Person_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public."Person_id_seq" OWNED BY public.person.id;
--
-- TOC entry 198 (class 1259 OID 16879)
-- Name: activity; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.activity (
id bigint NOT NULL,
name character varying NOT NULL,
"startDate" date NOT NULL,
"endDate" date NOT NULL,
creator_id bigint NOT NULL,
event_id bigint NOT NULL,
"endTime" time without time zone,
"startTime" time without time zone
);
ALTER TABLE public.activity OWNER TO postgres;
--
-- TOC entry 199 (class 1259 OID 16885)
-- Name: activity_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.activity_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.activity_id_seq OWNER TO postgres;
--
-- TOC entry 2863 (class 0 OID 0)
-- Dependencies: 199
-- Name: activity_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.activity_id_seq OWNED BY public.activity.id;
--
-- TOC entry 200 (class 1259 OID 16887)
-- Name: event; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.event (
"startDate" date NOT NULL,
"endDate" date NOT NULL,
name character varying NOT NULL,
id bigint NOT NULL,
creator_id bigint,
"endTime" time without time zone,
"startTime" time without time zone
);
ALTER TABLE public.event OWNER TO postgres;
--
-- TOC entry 2864 (class 0 OID 0)
-- Dependencies: 200
-- Name: TABLE event; Type: COMMENT; Schema: public; Owner: postgres
--
COMMENT ON TABLE public.event IS 'Represents events ';
--
-- TOC entry 201 (class 1259 OID 16893)
-- Name: event_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.event_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.event_id_seq OWNER TO postgres;
--
-- TOC entry 2865 (class 0 OID 0)
-- Dependencies: 201
-- Name: event_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.event_id_seq OWNED BY public.event.id;
--
-- TOC entry 202 (class 1259 OID 16895)
-- Name: registration; Type: TABLE; Schema: public; Owner: postgres
--
CREATE TABLE public.registration (
id bigint NOT NULL,
id_person bigint NOT NULL,
id_activity bigint NOT NULL
);
ALTER TABLE public.registration OWNER TO postgres;
--
-- TOC entry 203 (class 1259 OID 16898)
-- Name: registration_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
--
CREATE SEQUENCE public.registration_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.registration_id_seq OWNER TO postgres;
--
-- TOC entry 2866 (class 0 OID 0)
-- Dependencies: 203
-- Name: registration_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: postgres
--
ALTER SEQUENCE public.registration_id_seq OWNED BY public.registration.id;
--
-- TOC entry 2708 (class 2604 OID 16900)
-- Name: activity id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activity ALTER COLUMN id SET DEFAULT nextval('public.activity_id_seq'::regclass);
--
-- TOC entry 2709 (class 2604 OID 16901)
-- Name: event id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.event ALTER COLUMN id SET DEFAULT nextval('public.event_id_seq'::regclass);
--
-- TOC entry 2706 (class 2604 OID 16902)
-- Name: person id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.person ALTER COLUMN id SET DEFAULT nextval('public."Person_id_seq"'::regclass);
--
-- TOC entry 2710 (class 2604 OID 16903)
-- Name: registration id; Type: DEFAULT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.registration ALTER COLUMN id SET DEFAULT nextval('public.registration_id_seq'::regclass);
--
-- TOC entry 2851 (class 0 OID 16879)
-- Dependencies: 198
-- Data for Name: activity; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.activity (id, name, "startDate", "endDate", creator_id, event_id, "endTime", "startTime") FROM stdin;
11 Kayak 2019-08-01 2019-08-01 5 5 08:00:00 08:00:00
12 Counter Strike 2019-09-01 2019-09-01 6 6 08:00:00 08:00:00
\.
--
-- TOC entry 2853 (class 0 OID 16887)
-- Dependencies: 200
-- Data for Name: event; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.event ("startDate", "endDate", name, id, creator_id, "endTime", "startTime") FROM stdin;
2019-08-01 2019-08-10 Week-end sportif 5 5 08:00:00 08:00:00
2019-09-01 2019-09-10 Event E-sport 6 6 08:00:00 08:00:00
\.
--
-- TOC entry 2849 (class 0 OID 16871)
-- Dependencies: 196
-- Data for Name: person; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.person (id, "firstName", "lastName", email, "phoneNumber", password) FROM stdin;
5 Maxime Quoilin [email protected] 0498407095 azer
6 Damien Bouffioux [email protected] 0479308008 azer
\.
--
-- TOC entry 2855 (class 0 OID 16895)
-- Dependencies: 202
-- Data for Name: registration; Type: TABLE DATA; Schema: public; Owner: postgres
--
COPY public.registration (id, id_person, id_activity) FROM stdin;
9 5 11
10 6 12
\.
--
-- TOC entry 2867 (class 0 OID 0)
-- Dependencies: 197
-- Name: Person_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public."Person_id_seq"', 6, true);
--
-- TOC entry 2868 (class 0 OID 0)
-- Dependencies: 199
-- Name: activity_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.activity_id_seq', 12, true);
--
-- TOC entry 2869 (class 0 OID 0)
-- Dependencies: 201
-- Name: event_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.event_id_seq', 6, true);
--
-- TOC entry 2870 (class 0 OID 0)
-- Dependencies: 203
-- Name: registration_id_seq; Type: SEQUENCE SET; Schema: public; Owner: postgres
--
SELECT pg_catalog.setval('public.registration_id_seq', 10, true);
--
-- TOC entry 2707 (class 2606 OID 16904)
-- Name: person ch_pwd_lenght; Type: CHECK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE public.person
ADD CONSTRAINT ch_pwd_lenght CHECK ((length((password)::text) > 3)) NOT VALID;
--
-- TOC entry 2720 (class 2606 OID 16906)
-- Name: registration co_unique_registration; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.registration
ADD CONSTRAINT co_unique_registration UNIQUE (id_person, id_activity);
--
-- TOC entry 2716 (class 2606 OID 16908)
-- Name: activity pk_activity; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activity
ADD CONSTRAINT pk_activity PRIMARY KEY (id);
--
-- TOC entry 2718 (class 2606 OID 16910)
-- Name: event pk_event; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.event
ADD CONSTRAINT pk_event PRIMARY KEY (id);
--
-- TOC entry 2712 (class 2606 OID 16912)
-- Name: person pk_person; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.person
ADD CONSTRAINT pk_person PRIMARY KEY (id);
--
-- TOC entry 2722 (class 2606 OID 16914)
-- Name: registration pk_registration; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.registration
ADD CONSTRAINT pk_registration PRIMARY KEY (id);
--
-- TOC entry 2714 (class 2606 OID 16916)
-- Name: person un_email; Type: CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.person
ADD CONSTRAINT un_email UNIQUE (email);
--
-- TOC entry 2726 (class 2606 OID 16917)
-- Name: registration fk_activity; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.registration
ADD CONSTRAINT fk_activity FOREIGN KEY (id_activity) REFERENCES public.activity(id);
--
-- TOC entry 2723 (class 2606 OID 16922)
-- Name: activity fk_event; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activity
ADD CONSTRAINT fk_event FOREIGN KEY (event_id) REFERENCES public.event(id);
--
-- TOC entry 2727 (class 2606 OID 16927)
-- Name: registration fk_person; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.registration
ADD CONSTRAINT fk_person FOREIGN KEY (id_person) REFERENCES public.person(id);
--
-- TOC entry 2725 (class 2606 OID 16932)
-- Name: event fk_person; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.event
ADD CONSTRAINT fk_person FOREIGN KEY (creator_id) REFERENCES public.person(id);
--
-- TOC entry 2724 (class 2606 OID 16937)
-- Name: activity pk_person; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--
ALTER TABLE ONLY public.activity
ADD CONSTRAINT pk_person FOREIGN KEY (creator_id) REFERENCES public.person(id);
-- Completed on 2019-07-02 16:06:52
--
-- PostgreSQL database dump complete
--