Skip to main content
summaryrefslogtreecommitdiffstats
blob: d312ab343b29d04e67c2556c5767f61f608d1f0c (plain) (blame)
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
--
-- Tables for CacheDB
--
CREATE TABLE OPENK_CACHEDB_SEQ_TABLE
(
  SEQ_NAME  VARCHAR(32),
  SEQ_COUNT INTEGER
)
WITH (OIDS =FALSE
);
ALTER TABLE OPENK_CACHEDB_SEQ_TABLE OWNER TO cachedb;
-- Initialise Sequence Table
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('SYNCHRONOUS_MACHINE_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('GENERATING_UNIT_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('PSR_EVENT_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('LOCATION_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('EQUIPMENT_CONTAINER_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('CONNECTIVITY_NODE_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('TERMINAL_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('POWER_TRANSFORMER_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('BUSBAR_SECTION_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('SWITCH_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('MEASUREMENT_ANALOG_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('MEASUREMENT_ANALOG_VALUE_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('POSITION_POINT_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('REDUCTION_SETTING_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('AC_LINE_SEGMENT_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('GEOGRAPHICAL_REGION_SEQ', 1);
INSERT INTO OPENK_CACHEDB_SEQ_TABLE (seq_name, seq_count) VALUES ('SUBGEOGRAPHICAL_REGION_SEQ', 1);

CREATE TABLE GEOGRAPHICAL_REGION
(
  ID   INTEGER NOT NULL,
  MRID VARCHAR(16),
  NAME VARCHAR(64),
  CONSTRAINT "PK_GEOGRAPHICAL_REGION" PRIMARY KEY (ID)
)
WITH (OIDS =FALSE
);
ALTER TABLE GEOGRAPHICAL_REGION OWNER TO cachedb;

CREATE TABLE SUBGEOGRAPHICAL_REGION
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  GEOGRAPHICAL_REGION_ID INTEGER,
  CONSTRAINT "PK_SUBGEOGRAPHICAL_REGION" PRIMARY KEY (ID),
  CONSTRAINT "FK_SUBGEOGRAPHICAL_REGION_GEOGRAPHICAL_REGION" FOREIGN KEY (GEOGRAPHICAL_REGION_ID) REFERENCES GEOGRAPHICAL_REGION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE SUBGEOGRAPHICAL_REGION OWNER TO cachedb;

CREATE TABLE EQUIPMENT_CONTAINER
(
  ID                                 INTEGER NOT NULL,
  MRID                               VARCHAR(16) NOT NULL ,
  NAME                               VARCHAR(64),
  HIGH_VOLTAGE_LIMIT_VALUE           NUMERIC,
  HIGH_VOLTAGE_LIMIT_UNIT_MULTIPLIER VARCHAR(12),
  HIGH_VOLTAGE_LIMIT_UNIT_SYMBOL     VARCHAR(12),
  EQUIPMENT_CONTAINER_TYPE           VARCHAR(32),
  EQUIPMENT_CONTAINER_ID             INTEGER,
  SUBGEOGRAPHICAL_REGION_ID          INTEGER,
  CONSTRAINT "PK_EQUIPMENT_CONTAINER" PRIMARY KEY (ID),
  CONSTRAINT "FK_EQUIPMENT_CONTAINER_SUBGEOGRAPHICAL_REGION" FOREIGN KEY (SUBGEOGRAPHICAL_REGION_ID) REFERENCES SUBGEOGRAPHICAL_REGION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE EQUIPMENT_CONTAINER OWNER TO cachedb;

CREATE TABLE LOCATION
(
  ID            INTEGER NOT NULL,
  NAME          VARCHAR(64),
  STREET_NAME   VARCHAR(64),
  STREET_NUMBER VARCHAR(12),
  POSTAL_CODE   VARCHAR(12),
  CITY          VARCHAR(64),
  COUNTRY       VARCHAR(64),
  EMAIL         VARCHAR(64),
  CONSTRAINT "PK_LOCATION" PRIMARY KEY (ID)
)
WITH (OIDS =FALSE
);
ALTER TABLE LOCATION OWNER TO cachedb;

CREATE TABLE POSITION_POINT
(
  ID              INTEGER NOT NULL,
  SEQUENCE_NUMBER INTEGER,
  X_POSITION      VARCHAR(24),
  Y_POSITION      VARCHAR(24),
  Z_POSITION      VARCHAR(24),
  LOCATION_ID     INTEGER,
  CONSTRAINT "PK_POSITION_POINT" PRIMARY KEY (ID),
  CONSTRAINT "FK_POSITION_POINT_LOCATION" FOREIGN KEY (LOCATION_ID) REFERENCES LOCATION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE POSITION_POINT OWNER TO cachedb;

CREATE TABLE GENERATING_UNIT
(
  ID                                  INTEGER NOT NULL,
  HIGH_CONTROL_LIMIT_VALUE            NUMERIC,
  HIGH_CONTROL_LIMIT_UNIT_MULTIPLIER  VARCHAR(12),
  HIGH_CONTROL_LIMIT_UNIT_SYMBOL      VARCHAR(12),
  MAX_OPERATING_POWER_LIMIT_VALUE     NUMERIC,
  MAX_OPERATING_POWER_UNIT_MULTIPLIER VARCHAR(12),
  MAX_OPERATING_POWER_UNIT_SYMBOL     VARCHAR(12),
  CONTROL_SOURCE                      VARCHAR(24),
  UNIT_TYPE                           VARCHAR(12),
  CONSTRAINT "PK_GENERATING_UNIT_ID" PRIMARY KEY (ID)
)
WITH (OIDS =FALSE
);
ALTER TABLE GENERATING_UNIT OWNER TO cachedb;

CREATE TABLE SYNCHRONOUS_MACHINE
(
  ID                                 INTEGER     NOT NULL,
  MRID                               VARCHAR(16) NOT NULL,
  NAME                               VARCHAR(64),
  NORMALLY_IN_SERVICE                VARCHAR(5) NOT NULL,
  MAX_VOLTAGE_LIMIT_VALUE            NUMERIC,
  MAX_VOLTAGE_LIMIT_UNIT_MULTIPLIER  VARCHAR(12),
  MAX_VOLTAGE_LIMIT_UNIT_SYMBOL      VARCHAR(12),
  SYNCHRONOUS_MACHINE_KIND           VARCHAR(32) NOT NULL,
  CURRENT_REDUCTION_SETTING_PER_CENT INTEGER,
  FEED_IN_RANKING                    INTEGER,
  FEED_IN_PRIORITY                   INTEGER,
  COMMUNICATION_TYPE                 VARCHAR(12),
  COMMUNICATION_GROUP                INTEGER,
  CONTROL_ENABLED                    VARCHAR(5) NOT NULL,
  SYNCHRONOUS_MACHINE_ID             INTEGER,
  GENERATING_UNIT_ID                 INTEGER NOT NULL,
  LOCATION_ID                        INTEGER,
  EQUIPMENT_CONTAINER_ID             INTEGER,
  CONSTRAINT "PK_SYNCHRONOUS_MACHINE_ID" PRIMARY KEY (ID),
  CONSTRAINT "FK_SYNCHRONOUS_MACHINE_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_SYNCHRONOUS_MACHINE_GENERATING_UNIT" FOREIGN KEY (GENERATING_UNIT_ID) REFERENCES GENERATING_UNIT (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_SYNCHRONOUS_MACHINE_LOCATION" FOREIGN KEY (LOCATION_ID) REFERENCES LOCATION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_SYNCHRONOUS_MACHINE_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE SYNCHRONOUS_MACHINE OWNER TO cachedb;

CREATE TABLE REDUCTION_SETTING
(
  ID                         INTEGER NOT NULL,
  REDUCTION_SETTING_PER_CENT INTEGER,
  SYNCHRONOUS_MACHINE_ID     INTEGER,
  CONSTRAINT "PK_REDUCTION_SETTING_ID" PRIMARY KEY (ID),
  CONSTRAINT "FK_REDUCTION_SETTING_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE REDUCTION_SETTING OWNER TO cachedb;

CREATE TABLE MEASUREMENT_ANALOG
(
  ID                          INTEGER NOT NULL,
  MRID                        VARCHAR(16),
  MEASUREMENT_TYPE            VARCHAR(16),
  MEASUREMENT_UNIT_MULTIPLIER VARCHAR(12),
  MEASUREMENT_UNIT_SYMBOL     VARCHAR(12),
  MIN_VALUE                   NUMERIC,
  MAX_VALUE                   NUMERIC,
  NORMAL_VALUE                NUMERIC,
  SYNCHRONOUS_MACHINE_ID      INTEGER,
  CONSTRAINT "PK_MEASUREMENT_ANALOG" PRIMARY KEY (ID),
  CONSTRAINT "FK_MEASUREMENT_ANALOG_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE MEASUREMENT_ANALOG OWNER TO cachedb;

CREATE TABLE MEASUREMENT_ANALOG_VALUE
(
  ID                    INTEGER NOT NULL,
  TIMESTAMP_VALUE       TIMESTAMP,
  VALUE                 NUMERIC,
  MEASUREMENT_ANALOG_ID INTEGER,
  CONSTRAINT "PK_MEASUREMENT_ANALOG_VALUE" PRIMARY KEY (ID),
  CONSTRAINT "FK_MEASUREMENT_ANALOG_VALUE_MEASUREMENT_ANALOG" FOREIGN KEY (MEASUREMENT_ANALOG_ID) REFERENCES MEASUREMENT_ANALOG (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE MEASUREMENT_ANALOG_VALUE OWNER TO cachedb;

CREATE TABLE PSR_EVENT
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  PSR_EVENT_KIND         VARCHAR(16),
  TIMESTAMP_CREATED      TIMESTAMP,
  SYNCHRONOUS_MACHINE_ID INTEGER,
  CONSTRAINT "PK_PSR_EVENT" PRIMARY KEY (ID),
  CONSTRAINT "FK_PSR_EVENT_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE PSR_EVENT OWNER TO cachedb;

CREATE TABLE AC_LINE_SEGMENT
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  EQUIPMENT_CONTAINER_ID INTEGER,
  CONSTRAINT "PK_ACL_LINE_SEGMENT" PRIMARY KEY (ID),
  CONSTRAINT "FK_AC_LINE_SEGMENT_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE AC_LINE_SEGMENT OWNER TO cachedb;

CREATE TABLE POWER_TRANSFORMER
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  EQUIPMENT_CONTAINER_ID INTEGER,
  CONSTRAINT "PK_POWER_TRANSFORMER" PRIMARY KEY (ID),
  CONSTRAINT "FK_POWER_TRANSFORMER_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE POWER_TRANSFORMER OWNER TO cachedb;

CREATE TABLE SWITCH
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  OPEN                   VARCHAR(5),
  EQUIPMENT_CONTAINER_ID INTEGER,
  CONSTRAINT "PK_SWITCH" PRIMARY KEY (ID),
  CONSTRAINT "FK_SWITCH_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE SWITCH OWNER TO cachedb;

CREATE TABLE BUSBAR_SECTION
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  EQUIPMENT_CONTAINER_ID INTEGER,
  CONSTRAINT "PK_BUSBAR_SECTION" PRIMARY KEY (ID),
  CONSTRAINT "FK_BUSBAR_SECTION_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE BUSBAR_SECTION OWNER TO cachedb;

CREATE TABLE CONNECTIVITY_NODE
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  EQUIPMENT_CONTAINER_ID INTEGER,
  CONSTRAINT "PK_CONNECTIVITY_NODE" PRIMARY KEY (ID),
  CONSTRAINT "FK_CONNECTIVITY_NODE_EQUIPMENT_CONTAINER" FOREIGN KEY (EQUIPMENT_CONTAINER_ID) REFERENCES EQUIPMENT_CONTAINER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE CONNECTIVITY_NODE OWNER TO cachedb;

CREATE TABLE TERMINAL
(
  ID                     INTEGER NOT NULL,
  MRID                   VARCHAR(16),
  NAME                   VARCHAR(64),
  CONNECTIVITY_NODE_ID   INTEGER,
  POWER_TRANSFORMER_ID   INTEGER,
  BUSBAR_SECTION_ID      INTEGER,
  SWITCH_ID              INTEGER,
  SYNCHRONOUS_MACHINE_ID INTEGER,
  AC_LINE_SEGMENT_ID     INTEGER,
  CONSTRAINT "PK_TERMINAL" PRIMARY KEY (ID),
  CONSTRAINT "FK_TERMINAL_CONNECTIVITY_NODE" FOREIGN KEY (CONNECTIVITY_NODE_ID) REFERENCES CONNECTIVITY_NODE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_TERMINAL_POWER_TRANSFORMER" FOREIGN KEY (POWER_TRANSFORMER_ID) REFERENCES POWER_TRANSFORMER (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_TERMINAL_BUSBAR_SECTION" FOREIGN KEY (BUSBAR_SECTION_ID) REFERENCES BUSBAR_SECTION (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_TERMINAL_SWITCH" FOREIGN KEY (SWITCH_ID) REFERENCES SWITCH (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_TERMINAL_SYNCHRONOUS_MACHINE" FOREIGN KEY (SYNCHRONOUS_MACHINE_ID) REFERENCES SYNCHRONOUS_MACHINE (ID) ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT "FK_TERMINAL_AC_LINE_SEGMENT" FOREIGN KEY (AC_LINE_SEGMENT_ID) REFERENCES AC_LINE_SEGMENT (ID) ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS =FALSE
);
ALTER TABLE TERMINAL OWNER TO cachedb;

--
-- Tables for Quartz Job Scheduler
--
CREATE TABLE qrtz_job_details
(
  SCHED_NAME        VARCHAR(120) NOT NULL,
  JOB_NAME          VARCHAR(200) NOT NULL,
  JOB_GROUP         VARCHAR(200) NOT NULL,
  DESCRIPTION       VARCHAR(250) NULL,
  JOB_CLASS_NAME    VARCHAR(250) NOT NULL,
  IS_DURABLE        BOOL         NOT NULL,
  IS_NONCONCURRENT  BOOL         NOT NULL,
  IS_UPDATE_DATA    BOOL         NOT NULL,
  REQUESTS_RECOVERY BOOL         NOT NULL,
  JOB_DATA          BYTEA        NULL,
  PRIMARY KEY (SCHED_NAME, JOB_NAME, JOB_GROUP)
);

CREATE TABLE qrtz_triggers
(
  SCHED_NAME     VARCHAR(120) NOT NULL,
  TRIGGER_NAME   VARCHAR(200) NOT NULL,
  TRIGGER_GROUP  VARCHAR(200) NOT NULL,
  JOB_NAME       VARCHAR(200) NOT NULL,
  JOB_GROUP      VARCHAR(200) NOT NULL,
  DESCRIPTION    VARCHAR(250) NULL,
  NEXT_FIRE_TIME BIGINT       NULL,
  PREV_FIRE_TIME BIGINT       NULL,
  PRIORITY       INTEGER      NULL,
  TRIGGER_STATE  VARCHAR(16)  NOT NULL,
  TRIGGER_TYPE   VARCHAR(8)   NOT NULL,
  START_TIME     BIGINT       NOT NULL,
  END_TIME       BIGINT       NULL,
  CALENDAR_NAME  VARCHAR(200) NULL,
  MISFIRE_INSTR  SMALLINT     NULL,
  JOB_DATA       BYTEA        NULL,
  PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
  FOREIGN KEY (SCHED_NAME, JOB_NAME, JOB_GROUP)
  REFERENCES QRTZ_JOB_DETAILS (SCHED_NAME, JOB_NAME, JOB_GROUP)
);

CREATE TABLE qrtz_simple_triggers
(
  SCHED_NAME      VARCHAR(120) NOT NULL,
  TRIGGER_NAME    VARCHAR(200) NOT NULL,
  TRIGGER_GROUP   VARCHAR(200) NOT NULL,
  REPEAT_COUNT    BIGINT       NOT NULL,
  REPEAT_INTERVAL BIGINT       NOT NULL,
  TIMES_TRIGGERED BIGINT       NOT NULL,
  PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
  FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
  REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);

CREATE TABLE qrtz_cron_triggers
(
  SCHED_NAME      VARCHAR(120) NOT NULL,
  TRIGGER_NAME    VARCHAR(200) NOT NULL,
  TRIGGER_GROUP   VARCHAR(200) NOT NULL,
  CRON_EXPRESSION VARCHAR(120) NOT NULL,
  TIME_ZONE_ID    VARCHAR(80),
  PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
  FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
  REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);

CREATE TABLE qrtz_simprop_triggers
(
  SCHED_NAME    VARCHAR(120)   NOT NULL,
  TRIGGER_NAME  VARCHAR(200)   NOT NULL,
  TRIGGER_GROUP VARCHAR(200)   NOT NULL,
  STR_PROP_1    VARCHAR(512)   NULL,
  STR_PROP_2    VARCHAR(512)   NULL,
  STR_PROP_3    VARCHAR(512)   NULL,
  INT_PROP_1    INT            NULL,
  INT_PROP_2    INT            NULL,
  LONG_PROP_1   BIGINT         NULL,
  LONG_PROP_2   BIGINT         NULL,
  DEC_PROP_1    NUMERIC(13, 4) NULL,
  DEC_PROP_2    NUMERIC(13, 4) NULL,
  BOOL_PROP_1   BOOL           NULL,
  BOOL_PROP_2   BOOL           NULL,
  PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
  FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
  REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);

CREATE TABLE qrtz_blob_triggers
(
  SCHED_NAME    VARCHAR(120) NOT NULL,
  TRIGGER_NAME  VARCHAR(200) NOT NULL,
  TRIGGER_GROUP VARCHAR(200) NOT NULL,
  BLOB_DATA     BYTEA        NULL,
  PRIMARY KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP),
  FOREIGN KEY (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
  REFERENCES QRTZ_TRIGGERS (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP)
);

CREATE TABLE qrtz_calendars
(
  SCHED_NAME    VARCHAR(120) NOT NULL,
  CALENDAR_NAME VARCHAR(200) NOT NULL,
  CALENDAR      BYTEA        NOT NULL,
  PRIMARY KEY (SCHED_NAME, CALENDAR_NAME)
);


CREATE TABLE qrtz_paused_trigger_grps
(
  SCHED_NAME    VARCHAR(120) NOT NULL,
  TRIGGER_GROUP VARCHAR(200) NOT NULL,
  PRIMARY KEY (SCHED_NAME, TRIGGER_GROUP)
);

CREATE TABLE qrtz_fired_triggers
(
  SCHED_NAME        VARCHAR(120) NOT NULL,
  ENTRY_ID          VARCHAR(95)  NOT NULL,
  TRIGGER_NAME      VARCHAR(200) NOT NULL,
  TRIGGER_GROUP     VARCHAR(200) NOT NULL,
  INSTANCE_NAME     VARCHAR(200) NOT NULL,
  FIRED_TIME        BIGINT       NOT NULL,
  SCHED_TIME        BIGINT       NOT NULL,
  PRIORITY          INTEGER      NOT NULL,
  STATE             VARCHAR(16)  NOT NULL,
  JOB_NAME          VARCHAR(200) NULL,
  JOB_GROUP         VARCHAR(200) NULL,
  IS_NONCONCURRENT  BOOL         NULL,
  REQUESTS_RECOVERY BOOL         NULL,
  PRIMARY KEY (SCHED_NAME, ENTRY_ID)
);

CREATE TABLE qrtz_scheduler_state
(
  SCHED_NAME        VARCHAR(120) NOT NULL,
  INSTANCE_NAME     VARCHAR(200) NOT NULL,
  LAST_CHECKIN_TIME BIGINT       NOT NULL,
  CHECKIN_INTERVAL  BIGINT       NOT NULL,
  PRIMARY KEY (SCHED_NAME, INSTANCE_NAME)
);

CREATE TABLE qrtz_locks
(
  SCHED_NAME VARCHAR(120) NOT NULL,
  LOCK_NAME  VARCHAR(40)  NOT NULL,
  PRIMARY KEY (SCHED_NAME, LOCK_NAME)
);

CREATE INDEX idx_qrtz_j_req_recovery ON qrtz_job_details (SCHED_NAME, REQUESTS_RECOVERY);
CREATE INDEX idx_qrtz_j_grp ON qrtz_job_details (SCHED_NAME, JOB_GROUP);

CREATE INDEX idx_qrtz_t_j ON qrtz_triggers (SCHED_NAME, JOB_NAME, JOB_GROUP);
CREATE INDEX idx_qrtz_t_jg ON qrtz_triggers (SCHED_NAME, JOB_GROUP);
CREATE INDEX idx_qrtz_t_c ON qrtz_triggers (SCHED_NAME, CALENDAR_NAME);
CREATE INDEX idx_qrtz_t_g ON qrtz_triggers (SCHED_NAME, TRIGGER_GROUP);
CREATE INDEX idx_qrtz_t_state ON qrtz_triggers (SCHED_NAME, TRIGGER_STATE);
CREATE INDEX idx_qrtz_t_n_state ON qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, TRIGGER_STATE);
CREATE INDEX idx_qrtz_t_n_g_state ON qrtz_triggers (SCHED_NAME, TRIGGER_GROUP, TRIGGER_STATE);
CREATE INDEX idx_qrtz_t_next_fire_time ON qrtz_triggers (SCHED_NAME, NEXT_FIRE_TIME);
CREATE INDEX idx_qrtz_t_nft_st ON qrtz_triggers (SCHED_NAME, TRIGGER_STATE, NEXT_FIRE_TIME);
CREATE INDEX idx_qrtz_t_nft_misfire ON qrtz_triggers (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME);
CREATE INDEX idx_qrtz_t_nft_st_misfire ON qrtz_triggers (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_STATE);
CREATE INDEX idx_qrtz_t_nft_st_misfire_grp ON qrtz_triggers (SCHED_NAME, MISFIRE_INSTR, NEXT_FIRE_TIME, TRIGGER_GROUP, TRIGGER_STATE);

CREATE INDEX idx_qrtz_ft_trig_inst_name ON qrtz_fired_triggers (SCHED_NAME, INSTANCE_NAME);
CREATE INDEX idx_qrtz_ft_inst_job_req_rcvry ON qrtz_fired_triggers (SCHED_NAME, INSTANCE_NAME, REQUESTS_RECOVERY);
CREATE INDEX idx_qrtz_ft_j_g ON qrtz_fired_triggers (SCHED_NAME, JOB_NAME, JOB_GROUP);
CREATE INDEX idx_qrtz_ft_jg ON qrtz_fired_triggers (SCHED_NAME, JOB_GROUP);
CREATE INDEX idx_qrtz_ft_t_g ON qrtz_fired_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP);
CREATE INDEX idx_qrtz_ft_tg ON qrtz_fired_triggers (SCHED_NAME, TRIGGER_GROUP);




Back to the top