-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.sql
555 lines (367 loc) · 13.3 KB
/
init.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
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: analyzedtrip; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE analyzedtrip (
id_analyzedtrip integer NOT NULL,
id_startwaypoint integer NOT NULL,
id_endwaypoint integer NOT NULL,
id_transportline integer,
id_transporttype integer NOT NULL
);
ALTER TABLE public.analyzedtrip OWNER TO bigdata;
--
-- Name: analyzedtrip_id_analyzedtrip_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE analyzedtrip_id_analyzedtrip_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.analyzedtrip_id_analyzedtrip_seq OWNER TO bigdata;
--
-- Name: analyzedtrip_id_analyzedtrip_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE analyzedtrip_id_analyzedtrip_seq OWNED BY analyzedtrip.id_analyzedtrip;
--
-- Name: searchtable; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE searchtable (
searchstring text,
displaytext text NOT NULL,
search_category text,
the_geom geometry,
geometry_type text,
searchstring_tsvector tsvector,
showlayer character varying(256)
);
ALTER TABLE public.searchtable OWNER TO bigdata;
--
-- Name: track; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE track (
id_track integer NOT NULL,
name character varying(60) NOT NULL,
id_user integer NOT NULL
);
ALTER TABLE public.track OWNER TO bigdata;
--
-- Name: track_id_track_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE track_id_track_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.track_id_track_seq OWNER TO bigdata;
--
-- Name: track_id_track_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE track_id_track_seq OWNED BY track.id_track;
--
-- Name: transportline; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE transportline (
id_transportline bigint NOT NULL,
name character varying(255) NOT NULL,
id_type integer NOT NULL,
ref character varying(255)
);
ALTER TABLE public.transportline OWNER TO bigdata;
--
-- Name: transportline_id_transportline_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE transportline_id_transportline_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.transportline_id_transportline_seq OWNER TO bigdata;
--
-- Name: transportline_id_transportline_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE transportline_id_transportline_seq OWNED BY transportline.id_transportline;
--
-- Name: transportline_station; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE transportline_station (
id_transportline_station integer NOT NULL,
id_transportline bigint NOT NULL,
id_transportstation bigint NOT NULL,
sequence integer
);
ALTER TABLE public.transportline_station OWNER TO bigdata;
--
-- Name: transportline_station_id_transportline_station_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE transportline_station_id_transportline_station_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.transportline_station_id_transportline_station_seq OWNER TO bigdata;
--
-- Name: transportline_station_id_transportline_station_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE transportline_station_id_transportline_station_seq OWNED BY transportline_station.id_transportline_station;
--
-- Name: transportstation; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE transportstation (
id_transportstation bigint NOT NULL,
name character varying(255) NOT NULL,
city character varying(255) NOT NULL,
bench boolean,
shelter boolean,
point geometry
);
ALTER TABLE public.transportstation OWNER TO bigdata;
--
-- Name: transportstation_id_transportstation_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE transportstation_id_transportstation_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.transportstation_id_transportstation_seq OWNER TO bigdata;
--
-- Name: transportstation_id_transportstation_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE transportstation_id_transportstation_seq OWNED BY transportstation.id_transportstation;
--
-- Name: transporttype; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE transporttype (
id_transporttype integer NOT NULL,
name character varying(45) NOT NULL
);
ALTER TABLE public.transporttype OWNER TO bigdata;
--
-- Name: transporttype_id_transporttype_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE transporttype_id_transporttype_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.transporttype_id_transporttype_seq OWNER TO bigdata;
--
-- Name: transporttype_id_transporttype_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE transporttype_id_transporttype_seq OWNED BY transporttype.id_transporttype;
--
-- Name: user_account; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE user_account (
id_user integer NOT NULL,
prename character varying(80) NOT NULL,
lastname character varying(80) NOT NULL
);
ALTER TABLE public.user_account OWNER TO bigdata;
--
-- Name: user_account_id_user_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE user_account_id_user_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.user_account_id_user_seq OWNER TO bigdata;
--
-- Name: user_account_id_user_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE user_account_id_user_seq OWNED BY user_account.id_user;
--
-- Name: waypoint; Type: TABLE; Schema: public; Owner: bigdata; Tablespace:
--
CREATE TABLE waypoint (
id_waypoint integer NOT NULL,
time_stamp timestamp with time zone NOT NULL,
pnt geometry NOT NULL,
speed double precision,
accuracy double precision,
altitude smallint,
satelittes smallint,
sequence_no integer NOT NULL,
id_track integer NOT NULL
);
ALTER TABLE public.waypoint OWNER TO bigdata;
--
-- Name: waypoint_id_waypoint_seq; Type: SEQUENCE; Schema: public; Owner: bigdata
--
CREATE SEQUENCE waypoint_id_waypoint_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.waypoint_id_waypoint_seq OWNER TO bigdata;
--
-- Name: waypoint_id_waypoint_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: bigdata
--
ALTER SEQUENCE waypoint_id_waypoint_seq OWNED BY waypoint.id_waypoint;
--
-- Name: id_analyzedtrip; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY analyzedtrip ALTER COLUMN id_analyzedtrip SET DEFAULT nextval('analyzedtrip_id_analyzedtrip_seq'::regclass);
--
-- Name: id_track; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY track ALTER COLUMN id_track SET DEFAULT nextval('track_id_track_seq'::regclass);
--
-- Name: id_transportline; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transportline ALTER COLUMN id_transportline SET DEFAULT nextval('transportline_id_transportline_seq'::regclass);
--
-- Name: id_transportline_station; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transportline_station ALTER COLUMN id_transportline_station SET DEFAULT nextval('transportline_station_id_transportline_station_seq'::regclass);
--
-- Name: id_transportstation; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transportstation ALTER COLUMN id_transportstation SET DEFAULT nextval('transportstation_id_transportstation_seq'::regclass);
--
-- Name: id_transporttype; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transporttype ALTER COLUMN id_transporttype SET DEFAULT nextval('transporttype_id_transporttype_seq'::regclass);
--
-- Name: id_user; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY user_account ALTER COLUMN id_user SET DEFAULT nextval('user_account_id_user_seq'::regclass);
--
-- Name: id_waypoint; Type: DEFAULT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY waypoint ALTER COLUMN id_waypoint SET DEFAULT nextval('waypoint_id_waypoint_seq'::regclass);
--
-- Name: analyzedtrip_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY analyzedtrip
ADD CONSTRAINT analyzedtrip_pkey PRIMARY KEY (id_analyzedtrip);
--
-- Name: searchtable_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY searchtable
ADD CONSTRAINT searchtable_pkey PRIMARY KEY (displaytext);
--
-- Name: track_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY track
ADD CONSTRAINT track_pkey PRIMARY KEY (id_track);
--
-- Name: transportline_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY transportline
ADD CONSTRAINT transportline_pkey PRIMARY KEY (id_transportline);
--
-- Name: transportline_station_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY transportline_station
ADD CONSTRAINT transportline_station_pkey PRIMARY KEY (id_transportline_station);
--
-- Name: transportstation_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY transportstation
ADD CONSTRAINT transportstation_pkey PRIMARY KEY (id_transportstation);
--
-- Name: transporttype_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY transporttype
ADD CONSTRAINT transporttype_pkey PRIMARY KEY (id_transporttype);
--
-- Name: user_account_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY user_account
ADD CONSTRAINT user_account_pkey PRIMARY KEY (id_user);
--
-- Name: waypoint_pkey; Type: CONSTRAINT; Schema: public; Owner: bigdata; Tablespace:
--
ALTER TABLE ONLY waypoint
ADD CONSTRAINT waypoint_pkey PRIMARY KEY (id_waypoint);
--
-- Name: fki_transporttype_fk; Type: INDEX; Schema: public; Owner: bigdata; Tablespace:
--
CREATE INDEX fki_transporttype_fk ON analyzedtrip USING btree (id_transporttype);
--
-- Name: in_searchstring_tsvector_gin; Type: INDEX; Schema: public; Owner: bigdata; Tablespace:
--
CREATE INDEX in_searchstring_tsvector_gin ON searchtable USING gin (searchstring_tsvector);
--
-- Name: end_point_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY analyzedtrip
ADD CONSTRAINT end_point_fk FOREIGN KEY (id_endwaypoint) REFERENCES waypoint(id_waypoint);
--
-- Name: start_point_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY analyzedtrip
ADD CONSTRAINT start_point_fk FOREIGN KEY (id_startwaypoint) REFERENCES waypoint(id_waypoint);
--
-- Name: track_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY waypoint
ADD CONSTRAINT track_fk FOREIGN KEY (id_track) REFERENCES track(id_track) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- Name: transportline_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY analyzedtrip
ADD CONSTRAINT transportline_fk FOREIGN KEY (id_transportline) REFERENCES transportline(id_transportline);
--
-- Name: transportline_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transportline_station
ADD CONSTRAINT transportline_fk FOREIGN KEY (id_transportline) REFERENCES transportline(id_transportline);
--
-- Name: transportstation_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transportline_station
ADD CONSTRAINT transportstation_fk FOREIGN KEY (id_transportstation) REFERENCES transportstation(id_transportstation);
--
-- Name: transporttype_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY analyzedtrip
ADD CONSTRAINT transporttype_fk FOREIGN KEY (id_transporttype) REFERENCES transporttype(id_transporttype);
--
-- Name: type_transportline_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY transportline
ADD CONSTRAINT type_transportline_fk FOREIGN KEY (id_type) REFERENCES transporttype(id_transporttype);
--
-- Name: user_fk; Type: FK CONSTRAINT; Schema: public; Owner: bigdata
--
ALTER TABLE ONLY track
ADD CONSTRAINT user_fk FOREIGN KEY (id_user) REFERENCES user_account(id_user) ON UPDATE RESTRICT ON DELETE RESTRICT;
--
-- Name: 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;
--
-- Name: searchtable; Type: ACL; Schema: public; Owner: bigdata
--
REVOKE ALL ON TABLE searchtable FROM PUBLIC;
REVOKE ALL ON TABLE searchtable FROM bigdata;
GRANT ALL ON TABLE searchtable TO bigdata;
--
-- PostgreSQL database dump complete
--