-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
schema.sql
586 lines (364 loc) · 12.2 KB
/
schema.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
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
--
-- PostgreSQL database dump
--
-- Dumped from database version 13.9 (Ubuntu 13.9-1.pgdg20.04+1)
-- Dumped by pg_dump version 14.10 (Homebrew)
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: btree_gin; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS btree_gin WITH SCHEMA public;
--
-- Name: EXTENSION btree_gin; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION btree_gin IS 'support for indexing common datatypes in GIN';
--
-- Name: btree_gist; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS btree_gist WITH SCHEMA public;
--
-- Name: EXTENSION btree_gist; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION btree_gist IS 'support for indexing common datatypes in GiST';
--
-- Name: citext; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS citext WITH SCHEMA public;
--
-- Name: EXTENSION citext; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings';
--
-- Name: cube; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS cube WITH SCHEMA public;
--
-- Name: EXTENSION cube; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION cube IS 'data type for multidimensional cubes';
--
-- Name: dblink; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS dblink WITH SCHEMA public;
--
-- Name: EXTENSION dblink; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION dblink IS 'connect to other PostgreSQL databases from within a database';
--
-- Name: dict_int; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS dict_int WITH SCHEMA public;
--
-- Name: EXTENSION dict_int; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION dict_int IS 'text search dictionary template for integers';
--
-- Name: dict_xsyn; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS dict_xsyn WITH SCHEMA public;
--
-- Name: EXTENSION dict_xsyn; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION dict_xsyn IS 'text search dictionary template for extended synonym processing';
--
-- Name: earthdistance; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS earthdistance WITH SCHEMA public;
--
-- Name: EXTENSION earthdistance; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION earthdistance IS 'calculate great-circle distances on the surface of the Earth';
--
-- Name: fuzzystrmatch; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch WITH SCHEMA public;
--
-- Name: EXTENSION fuzzystrmatch; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION fuzzystrmatch IS 'determine similarities and distance between strings';
--
-- Name: hstore; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS hstore WITH SCHEMA public;
--
-- Name: EXTENSION hstore; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION hstore IS 'data type for storing sets of (key, value) pairs';
--
-- Name: intarray; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS intarray WITH SCHEMA public;
--
-- Name: EXTENSION intarray; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION intarray IS 'functions, operators, and index support for 1-D arrays of integers';
--
-- Name: ltree; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS ltree WITH SCHEMA public;
--
-- Name: EXTENSION ltree; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION ltree IS 'data type for hierarchical tree-like structures';
--
-- Name: pg_stat_statements; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pg_stat_statements WITH SCHEMA public;
--
-- Name: EXTENSION pg_stat_statements; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pg_stat_statements IS 'track planning and execution statistics of all SQL statements executed';
--
-- Name: pg_trgm; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
--
-- Name: EXTENSION pg_trgm; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pg_trgm IS 'text similarity measurement and index searching based on trigrams';
--
-- Name: pgcrypto; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pgcrypto WITH SCHEMA public;
--
-- Name: EXTENSION pgcrypto; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pgcrypto IS 'cryptographic functions';
--
-- Name: pgrowlocks; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pgrowlocks WITH SCHEMA public;
--
-- Name: EXTENSION pgrowlocks; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pgrowlocks IS 'show row-level locking information';
--
-- Name: pgstattuple; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS pgstattuple WITH SCHEMA public;
--
-- Name: EXTENSION pgstattuple; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION pgstattuple IS 'show tuple-level statistics';
--
-- Name: tablefunc; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS tablefunc WITH SCHEMA public;
--
-- Name: EXTENSION tablefunc; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION tablefunc IS 'functions that manipulate whole tables, including crosstab';
--
-- Name: unaccent; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS unaccent WITH SCHEMA public;
--
-- Name: EXTENSION unaccent; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION unaccent IS 'text search dictionary that removes accents';
--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
--
-- Name: xml2; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS xml2 WITH SCHEMA public;
--
-- Name: EXTENSION xml2; Type: COMMENT; Schema: -; Owner:
--
COMMENT ON EXTENSION xml2 IS 'XPath querying and XSLT';
SET default_tablespace = '';
SET default_table_access_method = heap;
--
-- Name: alerts; Type: TABLE; Schema: public; Owner: zdjrortn
--
CREATE TABLE public.alerts (
alert_id uuid NOT NULL,
user_id integer,
alert_obj json NOT NULL
);
ALTER TABLE public.alerts OWNER TO zdjrortn;
--
-- Name: monitors; Type: TABLE; Schema: public; Owner: zdjrortn
--
CREATE TABLE public.monitors (
monitor_id integer NOT NULL,
type character varying(16) NOT NULL,
user_id integer NOT NULL,
parameters json
);
ALTER TABLE public.monitors OWNER TO zdjrortn;
--
-- Name: monitors_monitor_id_seq; Type: SEQUENCE; Schema: public; Owner: zdjrortn
--
CREATE SEQUENCE public.monitors_monitor_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.monitors_monitor_id_seq OWNER TO zdjrortn;
--
-- Name: monitors_monitor_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: zdjrortn
--
ALTER SEQUENCE public.monitors_monitor_id_seq OWNED BY public.monitors.monitor_id;
--
-- Name: stats; Type: TABLE; Schema: public; Owner: zdjrortn
--
CREATE TABLE public.stats (
stats_id integer NOT NULL,
monitor_id integer,
table_name character varying(255),
num_rows integer,
stats_obj json,
starting timestamp with time zone,
ending timestamp with time zone
);
ALTER TABLE public.stats OWNER TO zdjrortn;
--
-- Name: stats_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: zdjrortn
--
CREATE SEQUENCE public.stats_stats_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.stats_stats_id_seq OWNER TO zdjrortn;
--
-- Name: stats_stats_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: zdjrortn
--
ALTER SEQUENCE public.stats_stats_id_seq OWNED BY public.stats.stats_id;
--
-- Name: uris; Type: TABLE; Schema: public; Owner: zdjrortn
--
CREATE TABLE public.uris (
uri_id integer NOT NULL,
uri text NOT NULL
);
ALTER TABLE public.uris OWNER TO zdjrortn;
--
-- Name: uris_uri_id_seq; Type: SEQUENCE; Schema: public; Owner: zdjrortn
--
CREATE SEQUENCE public.uris_uri_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.uris_uri_id_seq OWNER TO zdjrortn;
--
-- Name: uris_uri_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: zdjrortn
--
ALTER SEQUENCE public.uris_uri_id_seq OWNED BY public.uris.uri_id;
--
-- Name: users; Type: TABLE; Schema: public; Owner: zdjrortn
--
CREATE TABLE public.users (
user_id integer NOT NULL,
username character varying(32) NOT NULL,
password character varying(255) NOT NULL,
uri_id integer NOT NULL
);
ALTER TABLE public.users OWNER TO zdjrortn;
--
-- Name: users_user_id_seq; Type: SEQUENCE; Schema: public; Owner: zdjrortn
--
CREATE SEQUENCE public.users_user_id_seq
AS integer
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER TABLE public.users_user_id_seq OWNER TO zdjrortn;
--
-- Name: users_user_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: zdjrortn
--
ALTER SEQUENCE public.users_user_id_seq OWNED BY public.users.user_id;
--
-- Name: monitors monitor_id; Type: DEFAULT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.monitors ALTER COLUMN monitor_id SET DEFAULT nextval('public.monitors_monitor_id_seq'::regclass);
--
-- Name: stats stats_id; Type: DEFAULT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.stats ALTER COLUMN stats_id SET DEFAULT nextval('public.stats_stats_id_seq'::regclass);
--
-- Name: uris uri_id; Type: DEFAULT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.uris ALTER COLUMN uri_id SET DEFAULT nextval('public.uris_uri_id_seq'::regclass);
--
-- Name: users user_id; Type: DEFAULT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.users ALTER COLUMN user_id SET DEFAULT nextval('public.users_user_id_seq'::regclass);
--
-- Name: alerts alerts_pkey; Type: CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.alerts
ADD CONSTRAINT alerts_pkey PRIMARY KEY (alert_id);
--
-- Name: monitors monitors_pkey; Type: CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.monitors
ADD CONSTRAINT monitors_pkey PRIMARY KEY (monitor_id);
--
-- Name: stats stats_pkey; Type: CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.stats
ADD CONSTRAINT stats_pkey PRIMARY KEY (stats_id);
--
-- Name: uris uris_pkey; Type: CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.uris
ADD CONSTRAINT uris_pkey PRIMARY KEY (uri_id);
--
-- Name: users users_pkey; Type: CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_pkey PRIMARY KEY (user_id);
--
-- Name: users users_username_key; Type: CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_username_key UNIQUE (username);
--
-- Name: alerts alerts_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.alerts
ADD CONSTRAINT alerts_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(user_id);
--
-- Name: monitors monitors_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.monitors
ADD CONSTRAINT monitors_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(user_id);
--
-- Name: stats stats_monitor_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.stats
ADD CONSTRAINT stats_monitor_id_fkey FOREIGN KEY (monitor_id) REFERENCES public.monitors(monitor_id);
--
-- Name: users users_uri_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: zdjrortn
--
ALTER TABLE ONLY public.users
ADD CONSTRAINT users_uri_id_fkey FOREIGN KEY (uri_id) REFERENCES public.uris(uri_id);
--
-- PostgreSQL database dump complete
--