-
Notifications
You must be signed in to change notification settings - Fork 18
/
schema.sql
595 lines (403 loc) · 15.9 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
586
587
588
589
590
591
592
593
594
--
-- 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;
--
-- 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';
SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: cache_group; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE cache_group (
id integer NOT NULL,
name text NOT NULL,
owner text,
description text,
created_at timestamp without time zone,
updated_at timestamp without time zone,
CONSTRAINT cache_group_name_check CHECK ((name <> ''::text))
);
--
-- Name: cache_group_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE cache_group_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: cache_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE cache_group_id_seq OWNED BY cache_group.id;
--
-- Name: http_part_config; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE http_part_config (
id integer NOT NULL,
part_id text NOT NULL,
owner text NOT NULL,
uri_to_interpolate text NOT NULL,
description text,
deprecated_in_favour_of text,
method text NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
cache_ttl integer DEFAULT 0,
alert_mails_enabled boolean DEFAULT false NOT NULL,
alert_absolute_threshold integer,
alert_percent_threshold real,
alert_interval integer DEFAULT 60 NOT NULL,
alert_mail_recipients text,
additional_valid_statuses text,
CONSTRAINT alert_mail_recipients_not_blank CHECK (((alert_mails_enabled = false) OR ((alert_mail_recipients IS NOT NULL) AND (alert_mail_recipients <> ''::text)))),
CONSTRAINT alert_thresholds_not_both_null CHECK (((alert_mails_enabled = false) OR ((alert_absolute_threshold IS NOT NULL) OR (alert_percent_threshold IS NOT NULL)))),
CONSTRAINT http_part_config_alert_absolute_threshold_check CHECK (((alert_absolute_threshold IS NULL) OR (alert_absolute_threshold >= 0))),
CONSTRAINT http_part_config_alert_interval_check CHECK ((alert_interval > 0)),
CONSTRAINT http_part_config_alert_percent_threshold_check CHECK (((alert_percent_threshold IS NULL) OR ((alert_percent_threshold >= (0)::double precision) AND (alert_percent_threshold <= (100)::double precision)))),
CONSTRAINT http_part_config_deprecated_in_favour_of_check CHECK ((deprecated_in_favour_of <> ''::text)),
CONSTRAINT http_part_config_method_check CHECK ((method <> ''::text)),
CONSTRAINT http_part_config_part_id_check CHECK ((part_id <> ''::text)),
CONSTRAINT http_part_config_uri_to_interpolate_check CHECK ((uri_to_interpolate <> ''::text))
);
--
-- Name: COLUMN http_part_config.cache_ttl; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN http_part_config.cache_ttl IS 'in seconds';
--
-- Name: COLUMN http_part_config.alert_absolute_threshold; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN http_part_config.alert_absolute_threshold IS 'Number of errors or timeouts to trigger an alert mail';
--
-- Name: COLUMN http_part_config.alert_percent_threshold; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN http_part_config.alert_percent_threshold IS 'Ratio of errors or timeouts (as % of total requests) to trigger an alert mail';
--
-- Name: COLUMN http_part_config.alert_interval; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN http_part_config.alert_interval IS 'Timespan over which to count errors (now - X seconds)';
--
-- Name: COLUMN http_part_config.alert_mail_recipients; Type: COMMENT; Schema: public; Owner: -
--
COMMENT ON COLUMN http_part_config.alert_mail_recipients IS 'Mail To address (can be a comma-separated list)';
--
-- Name: http_part_config_cache_group; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE http_part_config_cache_group (
id integer NOT NULL,
cache_group_id bigint NOT NULL,
http_part_config_id bigint NOT NULL
);
--
-- Name: http_part_config_cache_group_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE http_part_config_cache_group_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: http_part_config_cache_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE http_part_config_cache_group_id_seq OWNED BY http_part_config_cache_group.id;
--
-- Name: http_part_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE http_part_config_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: http_part_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE http_part_config_id_seq OWNED BY http_part_config.id;
--
-- Name: hystrix_config; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE hystrix_config (
id integer NOT NULL,
http_part_config_id bigint NOT NULL,
thread_pool_config_id bigint NOT NULL,
command_key text NOT NULL,
command_group_key text NOT NULL,
timeout_in_ms bigint NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
CONSTRAINT hystrix_config_command_group_key_check CHECK ((command_group_key <> ''::text)),
CONSTRAINT hystrix_config_command_key_check CHECK ((command_key <> ''::text))
);
--
-- Name: hystrix_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE hystrix_config_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: hystrix_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE hystrix_config_id_seq OWNED BY hystrix_config.id;
--
-- Name: part_param; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE part_param (
id integer NOT NULL,
http_part_config_id bigint NOT NULL,
required boolean DEFAULT false NOT NULL,
param_type text NOT NULL,
output_name text NOT NULL,
input_name_override text,
created_at timestamp without time zone,
updated_at timestamp without time zone,
versioned boolean DEFAULT false NOT NULL,
CONSTRAINT part_param_input_name_override_check CHECK ((input_name_override <> ''::text)),
CONSTRAINT part_param_output_name_check CHECK ((output_name <> ''::text)),
CONSTRAINT part_param_param_type_check CHECK ((param_type <> ''::text))
);
--
-- Name: part_param_cache_group; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE part_param_cache_group (
id integer NOT NULL,
cache_group_id bigint NOT NULL,
part_param_id bigint NOT NULL
);
--
-- Name: part_param_cache_group_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE part_param_cache_group_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: part_param_cache_group_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE part_param_cache_group_id_seq OWNED BY part_param_cache_group.id;
--
-- Name: part_param_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE part_param_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: part_param_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE part_param_id_seq OWNED BY part_param.id;
--
-- Name: schema_version; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE schema_version (
version_rank integer NOT NULL,
installed_rank integer NOT NULL,
version character varying(50) NOT NULL,
description character varying(200) NOT NULL,
type character varying(20) NOT NULL,
script character varying(1000) NOT NULL,
checksum integer,
installed_by character varying(100) NOT NULL,
installed_on timestamp without time zone DEFAULT now() NOT NULL,
execution_time integer NOT NULL,
success boolean NOT NULL
);
--
-- Name: thread_pool_config; Type: TABLE; Schema: public; Owner: -; Tablespace:
--
CREATE TABLE thread_pool_config (
id integer NOT NULL,
thread_pool_key text NOT NULL,
core_size integer NOT NULL,
created_at timestamp without time zone,
updated_at timestamp without time zone,
CONSTRAINT thread_pool_config_thread_pool_key_check CHECK ((thread_pool_key <> ''::text))
);
--
-- Name: thread_pool_config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
--
CREATE SEQUENCE thread_pool_config_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
--
-- Name: thread_pool_config_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
--
ALTER SEQUENCE thread_pool_config_id_seq OWNED BY thread_pool_config.id;
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY cache_group ALTER COLUMN id SET DEFAULT nextval('cache_group_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY http_part_config ALTER COLUMN id SET DEFAULT nextval('http_part_config_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY http_part_config_cache_group ALTER COLUMN id SET DEFAULT nextval('http_part_config_cache_group_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY hystrix_config ALTER COLUMN id SET DEFAULT nextval('hystrix_config_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY part_param ALTER COLUMN id SET DEFAULT nextval('part_param_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY part_param_cache_group ALTER COLUMN id SET DEFAULT nextval('part_param_cache_group_id_seq'::regclass);
--
-- Name: id; Type: DEFAULT; Schema: public; Owner: -
--
ALTER TABLE ONLY thread_pool_config ALTER COLUMN id SET DEFAULT nextval('thread_pool_config_id_seq'::regclass);
--
-- Name: cache_group_name_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY cache_group
ADD CONSTRAINT cache_group_name_key UNIQUE (name);
--
-- Name: cache_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY cache_group
ADD CONSTRAINT cache_group_pkey PRIMARY KEY (id);
--
-- Name: http_part_config_cache_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY http_part_config_cache_group
ADD CONSTRAINT http_part_config_cache_group_pkey PRIMARY KEY (id);
--
-- Name: http_part_config_part_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY http_part_config
ADD CONSTRAINT http_part_config_part_id_key UNIQUE (part_id);
--
-- Name: http_part_config_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY http_part_config
ADD CONSTRAINT http_part_config_pkey PRIMARY KEY (id);
--
-- Name: hystrix_config_command_key_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY hystrix_config
ADD CONSTRAINT hystrix_config_command_key_key UNIQUE (command_key);
--
-- Name: hystrix_config_http_part_config_id_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY hystrix_config
ADD CONSTRAINT hystrix_config_http_part_config_id_key UNIQUE (http_part_config_id);
--
-- Name: hystrix_config_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY hystrix_config
ADD CONSTRAINT hystrix_config_pkey PRIMARY KEY (id);
--
-- Name: part_param_cache_group_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY part_param_cache_group
ADD CONSTRAINT part_param_cache_group_pkey PRIMARY KEY (id);
--
-- Name: part_param_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY part_param
ADD CONSTRAINT part_param_pkey PRIMARY KEY (id);
--
-- Name: schema_version_pk; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY schema_version
ADD CONSTRAINT schema_version_pk PRIMARY KEY (version);
--
-- Name: thread_pool_config_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY thread_pool_config
ADD CONSTRAINT thread_pool_config_pkey PRIMARY KEY (id);
--
-- Name: thread_pool_config_thread_pool_key_key; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
--
ALTER TABLE ONLY thread_pool_config
ADD CONSTRAINT thread_pool_config_thread_pool_key_key UNIQUE (thread_pool_key);
--
-- Name: cache_config_http_part_config_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX cache_config_http_part_config_idx ON http_part_config_cache_group USING btree (cache_group_id, http_part_config_id);
--
-- Name: cache_config_part_param_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX cache_config_part_param_idx ON part_param_cache_group USING btree (cache_group_id, part_param_id);
--
-- Name: part_param_http_part_config_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE UNIQUE INDEX part_param_http_part_config_idx ON part_param USING btree (http_part_config_id, param_type, output_name);
--
-- Name: schema_version_ir_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX schema_version_ir_idx ON schema_version USING btree (installed_rank);
--
-- Name: schema_version_s_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX schema_version_s_idx ON schema_version USING btree (success);
--
-- Name: schema_version_vr_idx; Type: INDEX; Schema: public; Owner: -; Tablespace:
--
CREATE INDEX schema_version_vr_idx ON schema_version USING btree (version_rank);
--
-- Name: http_part_config_cache_group_cache_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY http_part_config_cache_group
ADD CONSTRAINT http_part_config_cache_group_cache_group_id_fkey FOREIGN KEY (cache_group_id) REFERENCES cache_group(id) ON DELETE RESTRICT;
--
-- Name: http_part_config_cache_group_http_part_config_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY http_part_config_cache_group
ADD CONSTRAINT http_part_config_cache_group_http_part_config_id_fkey FOREIGN KEY (http_part_config_id) REFERENCES http_part_config(id) ON DELETE CASCADE;
--
-- Name: hystrix_config_http_part_config_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY hystrix_config
ADD CONSTRAINT hystrix_config_http_part_config_id_fkey FOREIGN KEY (http_part_config_id) REFERENCES http_part_config(id) ON DELETE CASCADE;
--
-- Name: hystrix_config_thread_pool_config_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY hystrix_config
ADD CONSTRAINT hystrix_config_thread_pool_config_id_fkey FOREIGN KEY (thread_pool_config_id) REFERENCES thread_pool_config(id) ON DELETE RESTRICT;
--
-- Name: part_param_cache_group_cache_group_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY part_param_cache_group
ADD CONSTRAINT part_param_cache_group_cache_group_id_fkey FOREIGN KEY (cache_group_id) REFERENCES cache_group(id) ON DELETE RESTRICT;
--
-- Name: part_param_cache_group_part_param_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY part_param_cache_group
ADD CONSTRAINT part_param_cache_group_part_param_id_fkey FOREIGN KEY (part_param_id) REFERENCES part_param(id) ON DELETE CASCADE;
--
-- Name: part_param_http_part_config_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY part_param
ADD CONSTRAINT part_param_http_part_config_id_fkey FOREIGN KEY (http_part_config_id) REFERENCES http_part_config(id) ON DELETE CASCADE;
--
-- PostgreSQL database dump complete
--