quartz.sql 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. -- ----------------------------
  2. -- qrtz_blob_triggers
  3. -- ----------------------------
  4. CREATE TABLE qrtz_blob_triggers
  5. (
  6. sched_name varchar(120) NOT NULL,
  7. trigger_name varchar(190) NOT NULL,
  8. trigger_group varchar(190) NOT NULL,
  9. blob_data bytea NULL,
  10. PRIMARY KEY (sched_name, trigger_name, trigger_group)
  11. );
  12. CREATE INDEX idx_qrtz_blob_triggers_sched_name ON qrtz_blob_triggers (sched_name, trigger_name, trigger_group);
  13. -- ----------------------------
  14. -- qrtz_calendars
  15. -- ----------------------------
  16. CREATE TABLE qrtz_calendars
  17. (
  18. sched_name varchar(120) NOT NULL,
  19. calendar_name varchar(190) NOT NULL,
  20. calendar bytea NOT NULL,
  21. PRIMARY KEY (sched_name, calendar_name)
  22. );
  23. -- ----------------------------
  24. -- qrtz_cron_triggers
  25. -- ----------------------------
  26. CREATE TABLE qrtz_cron_triggers
  27. (
  28. sched_name varchar(120) NOT NULL,
  29. trigger_name varchar(190) NOT NULL,
  30. trigger_group varchar(190) NOT NULL,
  31. cron_expression varchar(120) NOT NULL,
  32. time_zone_id varchar(80) NULL DEFAULT NULL,
  33. PRIMARY KEY (sched_name, trigger_name, trigger_group)
  34. );
  35. -- @formatter:off
  36. BEGIN;
  37. COMMIT;
  38. -- @formatter:on
  39. -- ----------------------------
  40. -- qrtz_fired_triggers
  41. -- ----------------------------
  42. CREATE TABLE qrtz_fired_triggers
  43. (
  44. sched_name varchar(120) NOT NULL,
  45. entry_id varchar(95) NOT NULL,
  46. trigger_name varchar(190) NOT NULL,
  47. trigger_group varchar(190) NOT NULL,
  48. instance_name varchar(190) NOT NULL,
  49. fired_time int8 NOT NULL,
  50. sched_time int8 NOT NULL,
  51. priority int4 NOT NULL,
  52. state varchar(16) NOT NULL,
  53. job_name varchar(190) NULL DEFAULT NULL,
  54. job_group varchar(190) NULL DEFAULT NULL,
  55. is_nonconcurrent varchar(1) NULL DEFAULT NULL,
  56. requests_recovery varchar(1) NULL DEFAULT NULL,
  57. PRIMARY KEY (sched_name, entry_id)
  58. );
  59. CREATE INDEX idx_qrtz_ft_trig_inst_name ON qrtz_fired_triggers (sched_name, instance_name);
  60. CREATE INDEX idx_qrtz_ft_inst_job_req_rcvry ON qrtz_fired_triggers (sched_name, instance_name, requests_recovery);
  61. CREATE INDEX idx_qrtz_ft_j_g ON qrtz_fired_triggers (sched_name, job_name, job_group);
  62. CREATE INDEX idx_qrtz_ft_jg ON qrtz_fired_triggers (sched_name, job_group);
  63. CREATE INDEX idx_qrtz_ft_t_g ON qrtz_fired_triggers (sched_name, trigger_name, trigger_group);
  64. CREATE INDEX idx_qrtz_ft_tg ON qrtz_fired_triggers (sched_name, trigger_group);
  65. -- ----------------------------
  66. -- qrtz_job_details
  67. -- ----------------------------
  68. CREATE TABLE qrtz_job_details
  69. (
  70. sched_name varchar(120) NOT NULL,
  71. job_name varchar(190) NOT NULL,
  72. job_group varchar(190) NOT NULL,
  73. description varchar(250) NULL DEFAULT NULL,
  74. job_class_name varchar(250) NOT NULL,
  75. is_durable varchar(1) NOT NULL,
  76. is_nonconcurrent varchar(1) NOT NULL,
  77. is_update_data varchar(1) NOT NULL,
  78. requests_recovery varchar(1) NOT NULL,
  79. job_data bytea NULL,
  80. PRIMARY KEY (sched_name, job_name, job_group)
  81. );
  82. CREATE INDEX idx_qrtz_j_req_recovery ON qrtz_job_details (sched_name, requests_recovery);
  83. CREATE INDEX idx_qrtz_j_grp ON qrtz_job_details (sched_name, job_group);
  84. -- @formatter:off
  85. BEGIN;
  86. COMMIT;
  87. -- @formatter:on
  88. -- ----------------------------
  89. -- qrtz_locks
  90. -- ----------------------------
  91. CREATE TABLE qrtz_locks
  92. (
  93. sched_name varchar(120) NOT NULL,
  94. lock_name varchar(40) NOT NULL,
  95. PRIMARY KEY (sched_name, lock_name)
  96. );
  97. -- @formatter:off
  98. BEGIN;
  99. COMMIT;
  100. -- @formatter:on
  101. -- ----------------------------
  102. -- qrtz_paused_trigger_grps
  103. -- ----------------------------
  104. CREATE TABLE qrtz_paused_trigger_grps
  105. (
  106. sched_name varchar(120) NOT NULL,
  107. trigger_group varchar(190) NOT NULL,
  108. PRIMARY KEY (sched_name, trigger_group)
  109. );
  110. -- ----------------------------
  111. -- qrtz_scheduler_state
  112. -- ----------------------------
  113. CREATE TABLE qrtz_scheduler_state
  114. (
  115. sched_name varchar(120) NOT NULL,
  116. instance_name varchar(190) NOT NULL,
  117. last_checkin_time int8 NOT NULL,
  118. checkin_interval int8 NOT NULL,
  119. PRIMARY KEY (sched_name, instance_name)
  120. );
  121. -- @formatter:off
  122. BEGIN;
  123. COMMIT;
  124. -- @formatter:on
  125. -- ----------------------------
  126. -- qrtz_simple_triggers
  127. -- ----------------------------
  128. CREATE TABLE qrtz_simple_triggers
  129. (
  130. sched_name varchar(120) NOT NULL,
  131. trigger_name varchar(190) NOT NULL,
  132. trigger_group varchar(190) NOT NULL,
  133. repeat_count int8 NOT NULL,
  134. repeat_interval int8 NOT NULL,
  135. times_triggered int8 NOT NULL,
  136. PRIMARY KEY (sched_name, trigger_name, trigger_group)
  137. );
  138. -- ----------------------------
  139. -- qrtz_simprop_triggers
  140. -- ----------------------------
  141. CREATE TABLE qrtz_simprop_triggers
  142. (
  143. sched_name varchar(120) NOT NULL,
  144. trigger_name varchar(190) NOT NULL,
  145. trigger_group varchar(190) NOT NULL,
  146. str_prop_1 varchar(512) NULL DEFAULT NULL,
  147. str_prop_2 varchar(512) NULL DEFAULT NULL,
  148. str_prop_3 varchar(512) NULL DEFAULT NULL,
  149. int_prop_1 int4 NULL DEFAULT NULL,
  150. int_prop_2 int4 NULL DEFAULT NULL,
  151. long_prop_1 int8 NULL DEFAULT NULL,
  152. long_prop_2 int8 NULL DEFAULT NULL,
  153. dec_prop_1 numeric(13, 4) NULL DEFAULT NULL,
  154. dec_prop_2 numeric(13, 4) NULL DEFAULT NULL,
  155. bool_prop_1 varchar(1) NULL DEFAULT NULL,
  156. bool_prop_2 varchar(1) NULL DEFAULT NULL,
  157. PRIMARY KEY (sched_name, trigger_name, trigger_group)
  158. );
  159. -- ----------------------------
  160. -- qrtz_triggers
  161. -- ----------------------------
  162. CREATE TABLE qrtz_triggers
  163. (
  164. sched_name varchar(120) NOT NULL,
  165. trigger_name varchar(190) NOT NULL,
  166. trigger_group varchar(190) NOT NULL,
  167. job_name varchar(190) NOT NULL,
  168. job_group varchar(190) NOT NULL,
  169. description varchar(250) NULL DEFAULT NULL,
  170. next_fire_time int8 NULL DEFAULT NULL,
  171. prev_fire_time int8 NULL DEFAULT NULL,
  172. priority int4 NULL DEFAULT NULL,
  173. trigger_state varchar(16) NOT NULL,
  174. trigger_type varchar(8) NOT NULL,
  175. start_time int8 NOT NULL,
  176. end_time int8 NULL DEFAULT NULL,
  177. calendar_name varchar(190) NULL DEFAULT NULL,
  178. misfire_instr int2 NULL DEFAULT NULL,
  179. job_data bytea NULL,
  180. PRIMARY KEY (sched_name, trigger_name, trigger_group)
  181. );
  182. CREATE INDEX idx_qrtz_t_j ON qrtz_triggers (sched_name, job_name, job_group);
  183. CREATE INDEX idx_qrtz_t_jg ON qrtz_triggers (sched_name, job_group);
  184. CREATE INDEX idx_qrtz_t_c ON qrtz_triggers (sched_name, calendar_name);
  185. CREATE INDEX idx_qrtz_t_g ON qrtz_triggers (sched_name, trigger_group);
  186. CREATE INDEX idx_qrtz_t_state ON qrtz_triggers (sched_name, trigger_state);
  187. CREATE INDEX idx_qrtz_t_n_state ON qrtz_triggers (sched_name, trigger_name, trigger_group, trigger_state);
  188. CREATE INDEX idx_qrtz_t_n_g_state ON qrtz_triggers (sched_name, trigger_group, trigger_state);
  189. CREATE INDEX idx_qrtz_t_next_fire_time ON qrtz_triggers (sched_name, next_fire_time);
  190. CREATE INDEX idx_qrtz_t_nft_st ON qrtz_triggers (sched_name, trigger_state, next_fire_time);
  191. CREATE INDEX idx_qrtz_t_nft_misfire ON qrtz_triggers (sched_name, misfire_instr, next_fire_time);
  192. CREATE INDEX idx_qrtz_t_nft_st_misfire ON qrtz_triggers (sched_name, misfire_instr, next_fire_time, trigger_state);
  193. CREATE INDEX idx_qrtz_t_nft_st_misfire_grp ON qrtz_triggers (sched_name, misfire_instr, next_fire_time, trigger_group,
  194. trigger_state);
  195. -- @formatter:off
  196. BEGIN;
  197. COMMIT;
  198. -- @formatter:on
  199. -- ----------------------------
  200. -- FK: qrtz_blob_triggers
  201. -- ----------------------------
  202. ALTER TABLE qrtz_blob_triggers
  203. ADD CONSTRAINT qrtz_blob_triggers_ibfk_1 FOREIGN KEY (sched_name, trigger_name, trigger_group) REFERENCES qrtz_triggers (sched_name,
  204. trigger_name,
  205. trigger_group);
  206. -- ----------------------------
  207. -- FK: qrtz_cron_triggers
  208. -- ----------------------------
  209. ALTER TABLE qrtz_cron_triggers
  210. ADD CONSTRAINT qrtz_cron_triggers_ibfk_1 FOREIGN KEY (sched_name, trigger_name, trigger_group) REFERENCES qrtz_triggers (sched_name, trigger_name, trigger_group);
  211. -- ----------------------------
  212. -- FK: qrtz_simple_triggers
  213. -- ----------------------------
  214. ALTER TABLE qrtz_simple_triggers
  215. ADD CONSTRAINT qrtz_simple_triggers_ibfk_1 FOREIGN KEY (sched_name, trigger_name, trigger_group) REFERENCES qrtz_triggers (sched_name,
  216. trigger_name,
  217. trigger_group);
  218. -- ----------------------------
  219. -- FK: qrtz_simprop_triggers
  220. -- ----------------------------
  221. ALTER TABLE qrtz_simprop_triggers
  222. ADD CONSTRAINT qrtz_simprop_triggers_ibfk_1 FOREIGN KEY (sched_name, trigger_name, trigger_group) REFERENCES qrtz_triggers (sched_name, trigger_name, trigger_group);
  223. -- ----------------------------
  224. -- FK: qrtz_triggers
  225. -- ----------------------------
  226. ALTER TABLE qrtz_triggers
  227. ADD CONSTRAINT qrtz_triggers_ibfk_1 FOREIGN KEY (sched_name, job_name, job_group) REFERENCES qrtz_job_details (sched_name, job_name, job_group);