quartz.sql 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. -- ----------------------------
  2. -- 1、存储每一个已配置的 jobDetail 的详细信息
  3. -- ----------------------------
  4. drop table if exists QRTZ_JOB_DETAILS;
  5. create table QRTZ_JOB_DETAILS (
  6. sched_name varchar(120) not null,
  7. job_name varchar(200) not null,
  8. job_group varchar(200) not null,
  9. description varchar(250) null,
  10. job_class_name varchar(250) not null,
  11. is_durable varchar(1) not null,
  12. is_nonconcurrent varchar(1) not null,
  13. is_update_data varchar(1) not null,
  14. requests_recovery varchar(1) not null,
  15. job_data blob null,
  16. primary key (sched_name,job_name,job_group)
  17. ) engine=innodb;
  18. -- ----------------------------
  19. -- 2、 存储已配置的 Trigger 的信息
  20. -- ----------------------------
  21. drop table if exists QRTZ_TRIGGERS;
  22. create table QRTZ_TRIGGERS (
  23. sched_name varchar(120) not null,
  24. trigger_name varchar(200) not null,
  25. trigger_group varchar(200) not null,
  26. job_name varchar(200) not null,
  27. job_group varchar(200) not null,
  28. description varchar(250) null,
  29. next_fire_time bigint(13) null,
  30. prev_fire_time bigint(13) null,
  31. priority integer null,
  32. trigger_state varchar(16) not null,
  33. trigger_type varchar(8) not null,
  34. start_time bigint(13) not null,
  35. end_time bigint(13) null,
  36. calendar_name varchar(200) null,
  37. misfire_instr smallint(2) null,
  38. job_data blob null,
  39. primary key (sched_name,trigger_name,trigger_group),
  40. foreign key (sched_name,job_name,job_group) references QRTZ_JOB_DETAILS(sched_name,job_name,job_group)
  41. ) engine=innodb;
  42. -- ----------------------------
  43. -- 3、 存储简单的 Trigger,包括重复次数,间隔,以及已触发的次数
  44. -- ----------------------------
  45. drop table if exists QRTZ_SIMPLE_TRIGGERS;
  46. create table QRTZ_SIMPLE_TRIGGERS (
  47. sched_name varchar(120) not null,
  48. trigger_name varchar(200) not null,
  49. trigger_group varchar(200) not null,
  50. repeat_count bigint(7) not null,
  51. repeat_interval bigint(12) not null,
  52. times_triggered bigint(10) not null,
  53. primary key (sched_name,trigger_name,trigger_group),
  54. foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group)
  55. ) engine=innodb;
  56. -- ----------------------------
  57. -- 4、 存储 Cron Trigger,包括 Cron 表达式和时区信息
  58. -- ----------------------------
  59. drop table if exists QRTZ_CRON_TRIGGERS;
  60. create table QRTZ_CRON_TRIGGERS (
  61. sched_name varchar(120) not null,
  62. trigger_name varchar(200) not null,
  63. trigger_group varchar(200) not null,
  64. cron_expression varchar(200) not null,
  65. time_zone_id varchar(80),
  66. primary key (sched_name,trigger_name,trigger_group),
  67. foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group)
  68. ) engine=innodb;
  69. -- ----------------------------
  70. -- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并不知道如何存储实例的时候)
  71. -- ----------------------------
  72. drop table if exists QRTZ_BLOB_TRIGGERS;
  73. create table QRTZ_BLOB_TRIGGERS (
  74. sched_name varchar(120) not null,
  75. trigger_name varchar(200) not null,
  76. trigger_group varchar(200) not null,
  77. blob_data blob null,
  78. primary key (sched_name,trigger_name,trigger_group),
  79. foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group)
  80. ) engine=innodb;
  81. -- ----------------------------
  82. -- 6、 以 Blob 类型存储存放日历信息, quartz可配置一个日历来指定一个时间范围
  83. -- ----------------------------
  84. drop table if exists QRTZ_CALENDARS;
  85. create table QRTZ_CALENDARS (
  86. sched_name varchar(120) not null,
  87. calendar_name varchar(200) not null,
  88. calendar blob not null,
  89. primary key (sched_name,calendar_name)
  90. ) engine=innodb;
  91. -- ----------------------------
  92. -- 7、 存储已暂停的 Trigger 组的信息
  93. -- ----------------------------
  94. drop table if exists QRTZ_PAUSED_TRIGGER_GRPS;
  95. create table QRTZ_PAUSED_TRIGGER_GRPS (
  96. sched_name varchar(120) not null,
  97. trigger_group varchar(200) not null,
  98. primary key (sched_name,trigger_group)
  99. ) engine=innodb;
  100. -- ----------------------------
  101. -- 8、 存储与已触发的 Trigger 相关的状态信息,以及相联 Job 的执行信息
  102. -- ----------------------------
  103. drop table if exists QRTZ_FIRED_TRIGGERS;
  104. create table QRTZ_FIRED_TRIGGERS (
  105. sched_name varchar(120) not null,
  106. entry_id varchar(95) not null,
  107. trigger_name varchar(200) not null,
  108. trigger_group varchar(200) not null,
  109. instance_name varchar(200) not null,
  110. fired_time bigint(13) not null,
  111. sched_time bigint(13) not null,
  112. priority integer not null,
  113. state varchar(16) not null,
  114. job_name varchar(200) null,
  115. job_group varchar(200) null,
  116. is_nonconcurrent varchar(1) null,
  117. requests_recovery varchar(1) null,
  118. primary key (sched_name,entry_id)
  119. ) engine=innodb;
  120. -- ----------------------------
  121. -- 9、 存储少量的有关 Scheduler 的状态信息,假如是用于集群中,可以看到其他的 Scheduler 实例
  122. -- ----------------------------
  123. drop table if exists QRTZ_SCHEDULER_STATE;
  124. create table QRTZ_SCHEDULER_STATE (
  125. sched_name varchar(120) not null,
  126. instance_name varchar(200) not null,
  127. last_checkin_time bigint(13) not null,
  128. checkin_interval bigint(13) not null,
  129. primary key (sched_name,instance_name)
  130. ) engine=innodb;
  131. -- ----------------------------
  132. -- 10、 存储程序的悲观锁的信息(假如使用了悲观锁)
  133. -- ----------------------------
  134. drop table if exists QRTZ_LOCKS;
  135. create table QRTZ_LOCKS (
  136. sched_name varchar(120) not null,
  137. lock_name varchar(40) not null,
  138. primary key (sched_name,lock_name)
  139. ) engine=innodb;
  140. drop table if exists QRTZ_SIMPROP_TRIGGERS;
  141. create table QRTZ_SIMPROP_TRIGGERS (
  142. sched_name varchar(120) not null,
  143. trigger_name varchar(200) not null,
  144. trigger_group varchar(200) not null,
  145. str_prop_1 varchar(512) null,
  146. str_prop_2 varchar(512) null,
  147. str_prop_3 varchar(512) null,
  148. int_prop_1 int null,
  149. int_prop_2 int null,
  150. long_prop_1 bigint null,
  151. long_prop_2 bigint null,
  152. dec_prop_1 numeric(13,4) null,
  153. dec_prop_2 numeric(13,4) null,
  154. bool_prop_1 varchar(1) null,
  155. bool_prop_2 varchar(1) null,
  156. primary key (sched_name,trigger_name,trigger_group),
  157. foreign key (sched_name,trigger_name,trigger_group) references QRTZ_TRIGGERS(sched_name,trigger_name,trigger_group)
  158. ) engine=innodb;
  159. commit;