-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinit.sql
More file actions
1066 lines (919 loc) · 31.1 KB
/
init.sql
File metadata and controls
1066 lines (919 loc) · 31.1 KB
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
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
CREATE EXTENSION IF NOT EXISTS vector;
-- pg_trgm 확장 설치
CREATE EXTENSION IF NOT EXISTS pg_trgm;
create table category
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
display_order integer,
name varchar(255) not null
constraint uk46ccwnsi9409t36lurvtyljak
unique
);
alter table category
owner to postgres;
create table favor
(
id bigint generated by default as identity
primary key,
name varchar(255) not null
constraint ukt6r4x9u0eh1a9yg98paeungkd
unique
);
alter table favor
owner to postgres;
create table hashtag
(
id bigint generated by default as identity
primary key,
name varchar(50) not null
constraint uktnicok67w95ajkoau49jeg9fm
unique
);
alter table hashtag
owner to postgres;
create table image
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
file_extension varchar(50) not null,
file_size bigint not null,
origin_file_name varchar(255) not null,
type varchar(255) not null
constraint image_type_check
check ((type)::text = ANY
((ARRAY ['BOARD'::character varying, 'REVIEW'::character varying, 'USER'::character varying, 'DEFAULT'::character varying])::text[])),
upload_file_name varchar(255) not null,
url varchar(255) not null
);
alter table image
owner to postgres;
create table notification_content
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
content varchar(255) not null,
redirection_url varchar(255)
);
alter table notification_content
owner to postgres;
create table pk_term
(
id bigint generated by default as identity
primary key,
end_date timestamp(6) not null,
start_date timestamp(6) not null,
term integer not null
);
alter table pk_term
owner to postgres;
create table store
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
deleted_at timestamp(6),
updated_at timestamp(6),
address varchar(255),
description varchar(255),
embedding_vector vector(1536),
eupmyeondong varchar(50),
mapx numeric(10, 7) not null,
mapy numeric(10, 7) not null,
name varchar(255) not null,
road_address varchar(255),
sido varchar(50),
sigungu varchar(50),
category_id bigint not null
constraint fko36xk5h32w3adfalrcm6ptis
references category,
constraint ukf5mdbnvt3ic06cpqk2fnotmis
unique (name, mapx, mapy)
);
alter table store
owner to postgres;
-- auto-generated definition
create table station
(
id bigint generated by default as identity
primary key,
embedding_vector vector(1536),
eupmyeondong varchar(50),
latitude numeric(10, 7) not null,
line varchar(255) not null,
longitude numeric(10, 7) not null,
name varchar(255) not null,
sido varchar(50),
sigungu varchar(50),
constraint uk_station_name_line
unique (name, line)
);
alter table station
owner to postgres;
create table users
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
deleted_at timestamp(6),
updated_at timestamp(6),
address varchar(255) not null,
age integer not null,
email varchar(255) not null
constraint uk6dotkott2kjsp8vw4d0m25fb7
unique,
follower integer not null,
following integer not null,
gender varchar(255)
constraint users_gender_check
check ((gender)::text = ANY
((ARRAY ['ANY'::character varying, 'FEMALE'::character varying, 'MALE'::character varying])::text[])),
level varchar(255) not null
constraint users_level_check
check ((level)::text = ANY ((ARRAY ['NORMAL'::character varying, 'PK'::character varying])::text[])),
nickname varchar(255) not null,
password varchar(255) not null,
point integer not null,
posting_count integer not null,
role varchar(255) not null
constraint users_role_check
check ((role)::text = ANY ((ARRAY ['USER'::character varying, 'ADMIN'::character varying])::text[])),
image_id bigint
constraint uk94dj9ry3k3tmcsyg8eatp7vvn
unique
constraint fklqj25c28swu46s4jbudd7hore
references image
);
alter table users
owner to postgres;
create table board
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
deleted_at timestamp(6),
updated_at timestamp(6),
access_policy varchar(255) not null
constraint board_access_policy_check
check ((access_policy)::text = ANY
((ARRAY ['OPEN'::character varying, 'CLOSED'::character varying, 'FCFS'::character varying, 'TIMEATTACK'::character varying])::text[])),
contents varchar(255) not null,
open_limit integer,
open_time timestamp(6),
search_keywords text,
search_nouns text,
search_phrases text,
title varchar(255) not null,
type varchar(255) not null
constraint board_type_check
check ((type)::text = ANY ((ARRAY ['N'::character varying, 'O'::character varying])::text[])),
store_id bigint not null
constraint fkqrcx4shwcq3xlx22i147o9dps
references store,
user_id bigint not null
constraint fk5vlh90qyii65ixwsbnafd55ud
references users
);
alter table board
owner to postgres;
create index idx_boards_search_keywords_trgm
on board using gin (search_keywords gin_trgm_ops);
create index idx_boards_search_nouns_trgm
on board using gin (search_nouns gin_trgm_ops);
create index idx_boards_search_phrases_trgm
on board using gin (search_phrases gin_trgm_ops);
create table board_hashtag
(
id bigint generated by default as identity
primary key,
board_id bigint not null
constraint fkgnj9sg4e3ru7ta9sa7fss2nlv
references board,
hashtag_id bigint not null
constraint fk2f8xm9sdi3i2m5r2gbo0968t0
references hashtag
);
alter table board_hashtag
owner to postgres;
create table board_image
(
id bigint generated by default as identity
primary key,
board_id bigint not null
constraint fkp567mlnww479xgirmd98kcqnp
references board,
image_id bigint not null
constraint fk27rfqpc9pf352xv9fhr4vklci
references image
on delete cascade
);
alter table board_image
owner to postgres;
create table comment
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
contents varchar(255) not null,
deleted_at timestamp(6),
board_id bigint not null
constraint fklij9oor1nav89jeat35s6kbp1
references board,
parent_comment bigint
constraint fkk5dgrgaxq2cnqqo788r2gysxo
references comment,
root_comment bigint
constraint fk1o5ni2rc96hm68w7uiuxatn12
references comment,
user_id bigint
constraint fkqm52p1v3o13hy268he0wcngr5
references users
);
alter table comment
owner to postgres;
create table event
(
id bigint generated by default as identity
primary key,
contents varchar(255) not null,
end_date date not null,
is_active boolean not null,
name varchar(255) not null,
start_date date not null,
user_id bigint not null
constraint fk31rxexkqqbeymnpw4d3bf9vsy
references users
);
alter table event
owner to postgres;
create table board_event
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
board_id bigint not null
constraint fka842v972cv5lf63bc7t0h6nwk
references board,
event_id bigint not null
constraint fkoix9haitanmbf65eg5fo6gkf8
references event
);
alter table board_event
owner to postgres;
create table follow
(
id bigint generated by default as identity
primary key,
follower_id bigint not null
constraint fkjikg34txcxnhcky26w14fvfcc
references users,
following_id bigint not null
constraint fk9oqsjovu9bl95dwt8ibiy2oey
references users
);
alter table follow
owner to postgres;
create table likes
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
board_id bigint not null
constraint fk5cq36196j3ww17d7r95qdm4td
references board,
user_id bigint not null
constraint fknvx9seeqqyy71bij291pwiwrg
references users
);
alter table likes
owner to postgres;
create table notification_info
(
id bigint not null
primary key,
created_at timestamp(6),
updated_at timestamp(6),
category varchar(255) not null
constraint notification_info_category_check
check ((category)::text = ANY
((ARRAY ['INDIVIDUAL'::character varying, 'SYSTEM'::character varying, 'MARKETING'::character varying, 'SUBSCRIBE'::character varying, 'PARTY'::character varying, 'CHAT'::character varying, 'STORE'::character varying, 'PK'::character varying, 'BOARD'::character varying, 'MATCH'::character varying, 'COMMENT'::character varying])::text[])),
is_read boolean not null,
notification_content_id bigint not null
constraint fkpb3knrbekad3namogsk229sod
references notification_content,
notification_target bigint not null
constraint fkfv5v471g6r1lak3gu0smnjkhi
references users
);
alter table notification_info
owner to postgres;
create table notification_setting
(
category varchar(255) not null,
accepted boolean not null,
user_id bigint not null
constraint fkmk226jk5f6j26wg7moshwhdx8
references users,
primary key (category, user_id)
);
alter table notification_setting
owner to postgres;
create table party
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
deleted_at timestamp(6),
updated_at timestamp(6),
description varchar(255),
enable_random_matching boolean not null,
max_members integer not null,
meeting_date date,
now_members integer not null,
party_status varchar(255) not null
constraint party_party_status_check
check ((party_status)::text = ANY
((ARRAY ['ACTIVE'::character varying, 'EXPIRED'::character varying])::text[])),
title varchar(255) not null,
user_id bigint not null
constraint fkovyvfds7dj7unwvquf3687j3i
references users
on delete cascade,
store_id bigint
constraint fkgte0ch57rdjr9y17l6dtnp6oa
references store
on delete cascade
);
alter table party
owner to postgres;
create table chat
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
message varchar(255) not null,
party_id bigint not null
constraint fkan05u3weewkna57iteoykmqe2
references party,
user_id bigint not null
constraint fk1x766u663l7m0mxuj0o72muu
references users
);
alter table chat
owner to postgres;
CREATE TABLE party_match_info
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
created_at TIMESTAMP(6),
max_age INTEGER,
min_age INTEGER,
gender VARCHAR(255)
CONSTRAINT party_match_info_gender_check CHECK (
gender IN ('ANY', 'FEMALE', 'MALE')
),
match_status VARCHAR(255)
CONSTRAINT party_match_info_match_status_check CHECK (
match_status IN ('IDLE', 'MATCHING', 'WAITING_HOST', 'WAITING_USER')
),
meeting_date DATE,
region VARCHAR(255),
party_id BIGINT NOT NULL
CONSTRAINT fk_party_match_info_party REFERENCES party (id) ON DELETE CASCADE,
store_id BIGINT
CONSTRAINT fk_party_match_info_store REFERENCES store (id)
);
ALTER TABLE party_match_info
OWNER TO postgres;
CREATE TABLE party_match_info_favor
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
favor_id BIGINT NOT NULL
CONSTRAINT fkdf8kumdjnhb66xt3cydk53om1
REFERENCES favor
ON DELETE CASCADE,
party_match_info_id BIGINT NOT NULL
CONSTRAINT fkjmdmov29xrfuwx20hidpp2322
REFERENCES party_match_info
ON DELETE CASCADE
);
ALTER TABLE party_match_info_favor
OWNER TO postgres;
create table pk_log
(
id bigint generated by default as identity
primary key,
created_at timestamp(6) not null,
pk_type varchar(255) not null
constraint pk_log_pk_type_check
check ((pk_type)::text = ANY
((ARRAY ['POST'::character varying, 'LIKE'::character varying, 'REVIEW'::character varying, 'EVENT'::character varying, 'RESET'::character varying])::text[])),
point integer not null,
user_id bigint not null
constraint fk6x6mvmyudbclsf97xpkwjq2aw
references users
);
alter table pk_log
owner to postgres;
create table pk_term_rank
(
id bigint generated by default as identity
primary key,
point integer not null,
ranking integer not null,
pk_term_id bigint not null
constraint fkj52poekt1r3e8i8ree6pou8mj
references pk_term,
user_id bigint not null
constraint fkl8nj51uepxkns6i0c0a1dskda
references users
);
alter table pk_term_rank
owner to postgres;
create table review
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
contents varchar(255) not null,
is_presented boolean not null,
is_validated boolean not null,
score integer not null,
image_id bigint
constraint ukc6cgb1awbhkdhsvgykdx8ikq3
unique
constraint fk2bu91x77t5ea5nb14e39mqcqs
references image,
store_id bigint not null
constraint fk74d12ba8sxxu9vpnc59b43y30
references store,
user_id bigint not null
constraint fk6cpw2nlklblpvc7hyt7ko6v3e
references users
);
alter table review
owner to postgres;
create table store_bucket
(
id bigint generated by default as identity
primary key,
is_opened boolean not null,
name varchar(255) not null,
user_id bigint not null
constraint fkk3yhb1qmlmbsk3wrhfunkss8g
references users
);
alter table store_bucket
owner to postgres;
create table bucket_item
(
id bigint generated by default as identity
primary key,
store_id bigint not null
constraint fkpj3nsiwnbel3douqt357p5j5j
references store,
bucket_id bigint not null
constraint fk7v0l122k2jv00sj7yc3cve69d
references store_bucket
);
alter table bucket_item
owner to postgres;
create table user_favor
(
id bigint generated by default as identity
primary key,
favor_id bigint not null
constraint fkfvisau9py077yj8y9faetakqy
references favor,
user_id bigint not null
constraint fkibvfs2851d7lompxolqbj93lw
references users
);
alter table user_favor
owner to postgres;
create table user_match_info
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
max_age integer,
min_age integer,
match_started_at timestamp(6),
match_status varchar(255)
constraint user_match_info_match_status_check
check ((match_status)::text = ANY
((ARRAY ['IDLE'::character varying, 'MATCHING'::character varying, 'WAITING_HOST'::character varying, 'WAITING_USER'::character varying])::text[])),
meeting_date date,
region varchar(255),
title varchar(255),
user_age integer,
user_gender varchar(255)
constraint user_match_info_user_gender_check
check ((user_gender)::text = ANY
((ARRAY ['ANY'::character varying, 'FEMALE'::character varying, 'MALE'::character varying])::text[])),
user_id bigint not null
constraint fk77rpqxprvi3kdqgprfwnpo85b
references users
on delete cascade
);
alter table user_match_info
owner to postgres;
create table party_invitation
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
invitation_status varchar(255) not null
constraint party_invitation_invitation_status_check
check ((invitation_status)::text = ANY
((ARRAY ['WAITING'::character varying, 'CONFIRMED'::character varying, 'REJECTED'::character varying, 'EXITED'::character varying, 'KICKED'::character varying])::text[])),
invitation_type varchar(255) not null
constraint party_invitation_invitation_type_check
check ((invitation_type)::text = ANY
((ARRAY ['REQUEST'::character varying, 'INVITATION'::character varying, 'RANDOM'::character varying])::text[])),
party_id bigint not null
constraint fkc44bpdpo4lorfob8nmd6nmj4x
references party
on delete cascade,
user_id bigint not null
constraint fklxycgrsowlie5jq18c2nt5sd7
references users
on delete cascade,
user_match_info_id bigint
constraint fkbk88cpb1xvkbnrq18dcre4j13
references user_match_info
);
alter table party_invitation
owner to postgres;
CREATE TABLE user_match_info_category
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
category_id BIGINT NOT NULL
CONSTRAINT fktclx38yl6r9qbusq5xl48220k
REFERENCES category
ON DELETE CASCADE,
user_match_info_id BIGINT NOT NULL
CONSTRAINT fk7fwrcch9dpd3ts8m3us4wp7j1
REFERENCES user_match_info
ON DELETE CASCADE
);
ALTER TABLE user_match_info_category
OWNER TO postgres;
CREATE TABLE user_match_info_favor
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
favor_id BIGINT NOT NULL
CONSTRAINT fk6e89k6djlsh8yb4f40defijp6
REFERENCES favor
ON DELETE CASCADE,
user_match_info_id BIGINT NOT NULL
CONSTRAINT fk65kv7x2gbsn9gcpveu8w3r2ef
REFERENCES user_match_info
ON DELETE CASCADE
);
ALTER TABLE user_match_info_favor
OWNER TO postgres;
CREATE TABLE user_match_info_store
(
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
store_id BIGINT NOT NULL
CONSTRAINT fklx7x0hba2kb801ijtkcv0jpw9
REFERENCES store
ON DELETE CASCADE,
user_match_info_id BIGINT NOT NULL
CONSTRAINT fkeen3n3apjqi73ei5oh9fy6qhy
REFERENCES user_match_info
ON DELETE CASCADE
);
ALTER TABLE user_match_info_store
OWNER TO postgres;
create table web_push_subscription
(
id bigint generated by default as identity
primary key,
fcm_token varchar(255)
constraint uk_fcm_token
unique,
user_id bigint
constraint fk9l1rhl0dux9hpjkq3bx83n8i5
references users
);
alter table web_push_subscription
owner to postgres;
create table user_notification_setting
(
id bigint generated by default as identity
primary key,
created_at timestamp(6),
updated_at timestamp(6),
notification_category smallint check (notification_category between 0 and 10),
user_id bigint
constraint fkdair81wsx5fq745jntidpc4pq
references users
);
alter table user_notification_setting
owner to postgres;
create table fcfs_information
(
id bigint generated by default as identity
primary key,
board_id bigint not null,
user_id bigint not null,
constraint uk_fcfs_board_user
unique (board_id, user_id)
);
alter table fcfs_information
owner to postgres;
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),
job_class_name varchar(250) not null,
is_durable boolean not null,
is_nonconcurrent boolean not null,
is_update_data boolean not null,
requests_recovery boolean not null,
job_data bytea,
primary key (sched_name, job_name, job_group)
);
alter table qrtz_job_details
owner to postgres;
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 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),
next_fire_time bigint,
prev_fire_time bigint,
priority integer,
trigger_state varchar(16) not null,
trigger_type varchar(8) not null,
start_time bigint not null,
end_time bigint,
calendar_name varchar(200),
misfire_instr smallint,
job_data bytea,
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, job_name, job_group) references qrtz_job_details
);
alter table qrtz_triggers
owner to postgres;
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 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
);
alter table qrtz_simple_triggers
owner to postgres;
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
);
alter table qrtz_cron_triggers
owner to postgres;
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),
str_prop_2 varchar(512),
str_prop_3 varchar(512),
int_prop_1 integer,
int_prop_2 integer,
long_prop_1 bigint,
long_prop_2 bigint,
dec_prop_1 numeric(13, 4),
dec_prop_2 numeric(13, 4),
bool_prop_1 boolean,
bool_prop_2 boolean,
primary key (sched_name, trigger_name, trigger_group),
constraint qrtz_simprop_triggers_sched_name_trigger_name_trigger_grou_fkey
foreign key (sched_name, trigger_name, trigger_group) references qrtz_triggers
);
alter table qrtz_simprop_triggers
owner to postgres;
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,
primary key (sched_name, trigger_name, trigger_group),
foreign key (sched_name, trigger_name, trigger_group) references qrtz_triggers
);
alter table qrtz_blob_triggers
owner to postgres;
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)
);
alter table qrtz_calendars
owner to postgres;
create table qrtz_paused_trigger_grps
(
sched_name varchar(120) not null,
trigger_group varchar(200) not null,
primary key (sched_name, trigger_group)
);
alter table qrtz_paused_trigger_grps
owner to postgres;
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),
job_group varchar(200),
is_nonconcurrent boolean,
requests_recovery boolean,
primary key (sched_name, entry_id)
);
alter table qrtz_fired_triggers
owner to postgres;
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);
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)
);
alter table qrtz_scheduler_state
owner to postgres;
create table qrtz_locks
(
sched_name varchar(120) not null,
lock_name varchar(40) not null,
primary key (sched_name, lock_name)
);
alter table qrtz_locks
owner to postgres;
create table batch_job_instance
(
job_instance_id bigint not null
primary key,
version bigint,
job_name varchar(100) not null,
job_key varchar(32) not null,
constraint job_inst_un
unique (job_name, job_key)
);
alter table batch_job_instance
owner to postgres;
create table batch_job_execution
(
job_execution_id bigint not null
primary key,
version bigint,
job_instance_id bigint not null
constraint job_inst_exec_fk
references batch_job_instance,
create_time timestamp not null,
start_time timestamp,
end_time timestamp,
status varchar(10),
exit_code varchar(2500),
exit_message varchar(2500),
last_updated timestamp
);
alter table batch_job_execution
owner to postgres;
create table batch_job_execution_params
(
job_execution_id bigint not null
constraint job_exec_params_fk
references batch_job_execution,
parameter_name varchar(100) not null,
parameter_type varchar(100) not null,
parameter_value varchar(2500),