quartz.sql 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. set client_min_messages = WARNING;
  2. DROP TABLE IF EXISTS qrtz_fired_triggers;
  3. DROP TABLE IF EXISTS qrtz_paused_trigger_grps;
  4. DROP TABLE IF EXISTS qrtz_scheduler_state;
  5. DROP TABLE IF EXISTS qrtz_locks;
  6. DROP TABLE IF EXISTS qrtz_simprop_triggers;
  7. DROP TABLE IF EXISTS qrtz_simple_triggers;
  8. DROP TABLE IF EXISTS qrtz_cron_triggers;
  9. DROP TABLE IF EXISTS qrtz_blob_triggers;
  10. DROP TABLE IF EXISTS qrtz_triggers;
  11. DROP TABLE IF EXISTS qrtz_job_details;
  12. DROP TABLE IF EXISTS qrtz_calendars;
  13. set client_min_messages = NOTICE;
  14. CREATE TABLE qrtz_job_details
  15. (
  16. sched_name TEXT NOT NULL,
  17. job_name TEXT NOT NULL,
  18. job_group TEXT NOT NULL,
  19. description TEXT NULL,
  20. job_class_name TEXT NOT NULL,
  21. is_durable BOOL NOT NULL,
  22. is_nonconcurrent BOOL NOT NULL,
  23. is_update_data BOOL NOT NULL,
  24. requests_recovery BOOL NOT NULL,
  25. job_data BYTEA NULL,
  26. PRIMARY KEY (sched_name,job_name,job_group)
  27. );
  28. CREATE TABLE qrtz_triggers
  29. (
  30. sched_name TEXT NOT NULL,
  31. trigger_name TEXT NOT NULL,
  32. trigger_group TEXT NOT NULL,
  33. job_name TEXT NOT NULL,
  34. job_group TEXT NOT NULL,
  35. description TEXT NULL,
  36. next_fire_time BIGINT NULL,
  37. prev_fire_time BIGINT NULL,
  38. priority INTEGER NULL,
  39. trigger_state TEXT NOT NULL,
  40. trigger_type TEXT NOT NULL,
  41. start_time BIGINT NOT NULL,
  42. end_time BIGINT NULL,
  43. calendar_name TEXT NULL,
  44. misfire_instr SMALLINT NULL,
  45. job_data BYTEA NULL,
  46. PRIMARY KEY (sched_name,trigger_name,trigger_group),
  47. FOREIGN KEY (sched_name,job_name,job_group)
  48. REFERENCES qrtz_job_details(sched_name,job_name,job_group)
  49. );
  50. CREATE TABLE qrtz_simple_triggers
  51. (
  52. sched_name TEXT NOT NULL,
  53. trigger_name TEXT NOT NULL,
  54. trigger_group TEXT NOT NULL,
  55. repeat_count BIGINT NOT NULL,
  56. repeat_interval BIGINT NOT NULL,
  57. times_triggered BIGINT NOT NULL,
  58. PRIMARY KEY (sched_name,trigger_name,trigger_group),
  59. FOREIGN KEY (sched_name,trigger_name,trigger_group)
  60. REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE
  61. );
  62. CREATE TABLE QRTZ_SIMPROP_TRIGGERS
  63. (
  64. sched_name TEXT NOT NULL,
  65. trigger_name TEXT NOT NULL ,
  66. trigger_group TEXT NOT NULL ,
  67. str_prop_1 TEXT NULL,
  68. str_prop_2 TEXT NULL,
  69. str_prop_3 TEXT NULL,
  70. int_prop_1 INTEGER NULL,
  71. int_prop_2 INTEGER NULL,
  72. long_prop_1 BIGINT NULL,
  73. long_prop_2 BIGINT NULL,
  74. dec_prop_1 NUMERIC NULL,
  75. dec_prop_2 NUMERIC NULL,
  76. bool_prop_1 BOOL NULL,
  77. bool_prop_2 BOOL NULL,
  78. time_zone_id TEXT NULL,
  79. PRIMARY KEY (sched_name,trigger_name,trigger_group),
  80. FOREIGN KEY (sched_name,trigger_name,trigger_group)
  81. REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE
  82. );
  83. CREATE TABLE qrtz_cron_triggers
  84. (
  85. sched_name TEXT NOT NULL,
  86. trigger_name TEXT NOT NULL,
  87. trigger_group TEXT NOT NULL,
  88. cron_expression TEXT NOT NULL,
  89. time_zone_id TEXT,
  90. PRIMARY KEY (sched_name,trigger_name,trigger_group),
  91. FOREIGN KEY (sched_name,trigger_name,trigger_group)
  92. REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE
  93. );
  94. CREATE TABLE qrtz_blob_triggers
  95. (
  96. sched_name TEXT NOT NULL,
  97. trigger_name TEXT NOT NULL,
  98. trigger_group TEXT NOT NULL,
  99. blob_data BYTEA NULL,
  100. PRIMARY KEY (sched_name,trigger_name,trigger_group),
  101. FOREIGN KEY (sched_name,trigger_name,trigger_group)
  102. REFERENCES qrtz_triggers(sched_name,trigger_name,trigger_group) ON DELETE CASCADE
  103. );
  104. CREATE TABLE qrtz_calendars
  105. (
  106. sched_name TEXT NOT NULL,
  107. calendar_name TEXT NOT NULL,
  108. calendar BYTEA NOT NULL,
  109. PRIMARY KEY (sched_name,calendar_name)
  110. );
  111. CREATE TABLE qrtz_paused_trigger_grps
  112. (
  113. sched_name TEXT NOT NULL,
  114. trigger_group TEXT NOT NULL,
  115. PRIMARY KEY (sched_name,trigger_group)
  116. );
  117. CREATE TABLE qrtz_fired_triggers
  118. (
  119. sched_name TEXT NOT NULL,
  120. entry_id TEXT NOT NULL,
  121. trigger_name TEXT NOT NULL,
  122. trigger_group TEXT NOT NULL,
  123. instance_name TEXT NOT NULL,
  124. fired_time BIGINT NOT NULL,
  125. sched_time BIGINT NOT NULL,
  126. priority INTEGER NOT NULL,
  127. state TEXT NOT NULL,
  128. job_name TEXT NULL,
  129. job_group TEXT NULL,
  130. is_nonconcurrent BOOL NOT NULL,
  131. requests_recovery BOOL NULL,
  132. PRIMARY KEY (sched_name,entry_id)
  133. );
  134. CREATE TABLE qrtz_scheduler_state
  135. (
  136. sched_name TEXT NOT NULL,
  137. instance_name TEXT NOT NULL,
  138. last_checkin_time BIGINT NOT NULL,
  139. checkin_interval BIGINT NOT NULL,
  140. PRIMARY KEY (sched_name,instance_name)
  141. );
  142. CREATE TABLE qrtz_locks
  143. (
  144. sched_name TEXT NOT NULL,
  145. lock_name TEXT NOT NULL,
  146. PRIMARY KEY (sched_name,lock_name)
  147. );
  148. create index idx_qrtz_j_req_recovery on qrtz_job_details(requests_recovery);
  149. create index idx_qrtz_t_next_fire_time on qrtz_triggers(next_fire_time);
  150. create index idx_qrtz_t_state on qrtz_triggers(trigger_state);
  151. create index idx_qrtz_t_nft_st on qrtz_triggers(next_fire_time,trigger_state);
  152. create index idx_qrtz_ft_trig_name on qrtz_fired_triggers(trigger_name);
  153. create index idx_qrtz_ft_trig_group on qrtz_fired_triggers(trigger_group);
  154. create index idx_qrtz_ft_trig_nm_gp on qrtz_fired_triggers(sched_name,trigger_name,trigger_group);
  155. create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers(instance_name);
  156. create index idx_qrtz_ft_job_name on qrtz_fired_triggers(job_name);
  157. create index idx_qrtz_ft_job_group on qrtz_fired_triggers(job_group);
  158. create index idx_qrtz_ft_job_req_recovery on qrtz_fired_triggers(requests_recovery);