/projects/quartz-1.8.3/docs/dbTables/tables_sybase.sql

https://gitlab.com/essere.lab.public/qualitas.class-corpus · SQL · 326 lines · 246 code · 49 blank · 31 comment · 0 complexity · 50db78db80e27ac0176372b4d7dcb712 MD5 · raw file

  1. /*==============================================================================================*/
  2. /* Quartz database tables creation script for Sybase ASE 12.5 */
  3. /* Written by Pertti Laiho (email: pertti.laiho@deio.net), 9th May 2003 */
  4. /* */
  5. /* Compatible with Quartz version 1.1.2 */
  6. /* */
  7. /* Sybase ASE works ok with the MSSQL delegate class. That means in your Quartz properties */
  8. /* file, you'll need to set: */
  9. /* org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.MSSQLDelegate */
  10. /*==============================================================================================*/
  11. use your_db_name_here
  12. go
  13. /*==============================================================================*/
  14. /* Clear all tables: */
  15. /*==============================================================================*/
  16. IF OBJECT_ID('QRTZ_JOB_LISTENERS') IS NOT NULL
  17. delete from QRTZ_JOB_LISTENERS
  18. go
  19. IF OBJECT_ID('QRTZ_TRIGGER_LISTENERS') IS NOT NULL
  20. delete from QRTZ_TRIGGER_LISTENERS
  21. go
  22. IF OBJECT_ID('QRTZ_FIRED_TRIGGERS') IS NOT NULL
  23. delete from QRTZ_FIRED_TRIGGERS
  24. go
  25. IF OBJECT_ID('QRTZ_PAUSED_TRIGGER_GRPS') IS NOT NULL
  26. delete from QRTZ_PAUSED_TRIGGER_GRPS
  27. go
  28. IF OBJECT_ID('QRTZ_SCHEDULER_STATE') IS NOT NULL
  29. delete from QRTZ_SCHEDULER_STATE
  30. go
  31. IF OBJECT_ID('QRTZ_LOCKS') IS NOT NULL
  32. delete from QRTZ_LOCKS
  33. go
  34. IF OBJECT_ID('QRTZ_SIMPLE_TRIGGERS') IS NOT NULL
  35. delete from QRTZ_SIMPLE_TRIGGERS
  36. go
  37. IF OBJECT_ID('QRTZ_CRON_TRIGGERS') IS NOT NULL
  38. delete from QRTZ_CRON_TRIGGERS
  39. go
  40. IF OBJECT_ID('QRTZ_BLOB_TRIGGERS') IS NOT NULL
  41. delete from QRTZ_BLOB_TRIGGERS
  42. go
  43. IF OBJECT_ID('QRTZ_TRIGGERS') IS NOT NULL
  44. delete from QRTZ_TRIGGERS
  45. go
  46. IF OBJECT_ID('QRTZ_JOB_DETAILS') IS NOT NULL
  47. delete from QRTZ_JOB_DETAILS
  48. go
  49. IF OBJECT_ID('QRTZ_CALENDARS') IS NOT NULL
  50. delete from QRTZ_CALENDARS
  51. go
  52. /*==============================================================================*/
  53. /* Drop constraints: */
  54. /*==============================================================================*/
  55. alter table QRTZ_JOB_LISTENERS
  56. drop constraint FK_job_listeners_job_details
  57. go
  58. alter table QRTZ_TRIGGERS
  59. drop constraint FK_triggers_job_details
  60. go
  61. alter table QRTZ_CRON_TRIGGERS
  62. drop constraint FK_cron_triggers_triggers
  63. go
  64. alter table QRTZ_SIMPLE_TRIGGERS
  65. drop constraint FK_simple_triggers_triggers
  66. go
  67. alter table QRTZ_TRIGGER_LISTENERS
  68. drop constraint FK_trigger_listeners_triggers
  69. go
  70. alter table QRTZ_BLOB_TRIGGERS
  71. drop constraint FK_blob_triggers_triggers
  72. go
  73. /*==============================================================================*/
  74. /* Drop tables: */
  75. /*==============================================================================*/
  76. drop table QRTZ_JOB_LISTENERS
  77. go
  78. drop table QRTZ_TRIGGER_LISTENERS
  79. go
  80. drop table QRTZ_FIRED_TRIGGERS
  81. go
  82. drop table QRTZ_PAUSED_TRIGGER_GRPS
  83. go
  84. drop table QRTZ_SCHEDULER_STATE
  85. go
  86. drop table QRTZ_LOCKS
  87. go
  88. drop table QRTZ_SIMPLE_TRIGGERS
  89. go
  90. drop table QRTZ_CRON_TRIGGERS
  91. go
  92. drop table QRTZ_BLOB_TRIGGERS
  93. go
  94. drop table QRTZ_TRIGGERS
  95. go
  96. drop table QRTZ_JOB_DETAILS
  97. go
  98. drop table QRTZ_CALENDARS
  99. go
  100. /*==============================================================================*/
  101. /* Create tables: */
  102. /*==============================================================================*/
  103. create table QRTZ_CALENDARS (
  104. CALENDAR_NAME varchar(80) not null,
  105. CALENDAR image not null
  106. )
  107. go
  108. create table QRTZ_CRON_TRIGGERS (
  109. TRIGGER_NAME varchar(80) not null,
  110. TRIGGER_GROUP varchar(80) not null,
  111. CRON_EXPRESSION varchar(120) not null,
  112. TIME_ZONE_ID varchar(80) null,
  113. )
  114. go
  115. create table QRTZ_PAUSED_TRIGGER_GRPS (
  116. TRIGGER_GROUP varchar(80) not null,
  117. )
  118. go
  119. create table QRTZ_FIRED_TRIGGERS(
  120. ENTRY_ID varchar(95) not null,
  121. TRIGGER_NAME varchar(80) not null,
  122. TRIGGER_GROUP varchar(80) not null,
  123. IS_VOLATILE bit not null,
  124. INSTANCE_NAME varchar(80) not null,
  125. FIRED_TIME numeric(13,0) not null,
  126. PRIORITY int not null,
  127. STATE varchar(16) not null,
  128. JOB_NAME varchar(80) null,
  129. JOB_GROUP varchar(80) null,
  130. IS_STATEFUL bit not null,
  131. REQUESTS_RECOVERY bit not null,
  132. )
  133. go
  134. create table QRTZ_SCHEDULER_STATE (
  135. INSTANCE_NAME varchar(80) not null,
  136. LAST_CHECKIN_TIME numeric(13,0) not null,
  137. CHECKIN_INTERVAL numeric(13,0) not null,
  138. )
  139. go
  140. create table QRTZ_LOCKS (
  141. LOCK_NAME varchar(40) not null,
  142. )
  143. go
  144. insert into QRTZ_LOCKS values('TRIGGER_ACCESS')
  145. go
  146. insert into QRTZ_LOCKS values('JOB_ACCESS')
  147. go
  148. insert into QRTZ_LOCKS values('CALENDAR_ACCESS')
  149. go
  150. insert into QRTZ_LOCKS values('STATE_ACCESS')
  151. go
  152. create table QRTZ_JOB_DETAILS (
  153. JOB_NAME varchar(80) not null,
  154. JOB_GROUP varchar(80) not null,
  155. DESCRIPTION varchar(120) null,
  156. JOB_CLASS_NAME varchar(128) not null,
  157. IS_DURABLE bit not null,
  158. IS_VOLATILE bit not null,
  159. IS_STATEFUL bit not null,
  160. REQUESTS_RECOVERY bit not null,
  161. JOB_DATA image null
  162. )
  163. go
  164. create table QRTZ_JOB_LISTENERS (
  165. JOB_NAME varchar(80) not null,
  166. JOB_GROUP varchar(80) not null,
  167. JOB_LISTENER varchar(80) not null
  168. )
  169. go
  170. create table QRTZ_SIMPLE_TRIGGERS (
  171. TRIGGER_NAME varchar(80) not null,
  172. TRIGGER_GROUP varchar(80) not null,
  173. REPEAT_COUNT numeric(13,0) not null,
  174. REPEAT_INTERVAL numeric(13,0) not null,
  175. TIMES_TRIGGERED numeric(13,0) not null
  176. )
  177. go
  178. create table QRTZ_BLOB_TRIGGERS (
  179. TRIGGER_NAME varchar(80) not null,
  180. TRIGGER_GROUP varchar(80) not null,
  181. BLOB_DATA image null
  182. )
  183. go
  184. create table QRTZ_TRIGGER_LISTENERS (
  185. TRIGGER_NAME varchar(80) not null,
  186. TRIGGER_GROUP varchar(80) not null,
  187. TRIGGER_LISTENER varchar(80) not null
  188. )
  189. go
  190. create table QRTZ_TRIGGERS (
  191. TRIGGER_NAME varchar(80) not null,
  192. TRIGGER_GROUP varchar(80) not null,
  193. JOB_NAME varchar(80) not null,
  194. JOB_GROUP varchar(80) not null,
  195. IS_VOLATILE bit not null,
  196. DESCRIPTION varchar(120) null,
  197. NEXT_FIRE_TIME numeric(13,0) null,
  198. PREV_FIRE_TIME numeric(13,0) null,
  199. PRIORITY int null,
  200. TRIGGER_STATE varchar(16) not null,
  201. TRIGGER_TYPE varchar(8) not null,
  202. START_TIME numeric(13,0) not null,
  203. END_TIME numeric(13,0) null,
  204. CALENDAR_NAME varchar(80) null,
  205. MISFIRE_INSTR smallint null,
  206. JOB_DATA image null
  207. )
  208. go
  209. /*==============================================================================*/
  210. /* Create primary key constraints: */
  211. /*==============================================================================*/
  212. alter table QRTZ_CALENDARS
  213. add constraint PK_qrtz_calendars primary key clustered (CALENDAR_NAME)
  214. go
  215. alter table QRTZ_CRON_TRIGGERS
  216. add constraint PK_qrtz_cron_triggers primary key clustered (TRIGGER_NAME, TRIGGER_GROUP)
  217. go
  218. alter table QRTZ_FIRED_TRIGGERS
  219. add constraint PK_qrtz_fired_triggers primary key clustered (ENTRY_ID)
  220. go
  221. alter table QRTZ_PAUSED_TRIGGER_GRPS
  222. add constraint PK_qrtz_paused_trigger_grps primary key clustered (TRIGGER_GROUP)
  223. go
  224. alter table QRTZ_SCHEDULER_STATE
  225. add constraint PK_qrtz_scheduler_state primary key clustered (INSTANCE_NAME)
  226. go
  227. alter table QRTZ_LOCKS
  228. add constraint PK_qrtz_locks primary key clustered (LOCK_NAME)
  229. go
  230. alter table QRTZ_JOB_DETAILS
  231. add constraint PK_qrtz_job_details primary key clustered (JOB_NAME, JOB_GROUP)
  232. go
  233. alter table QRTZ_JOB_LISTENERS
  234. add constraint PK_qrtz_job_listeners primary key clustered (JOB_NAME, JOB_GROUP, JOB_LISTENER)
  235. go
  236. alter table QRTZ_SIMPLE_TRIGGERS
  237. add constraint PK_qrtz_simple_triggers primary key clustered (TRIGGER_NAME, TRIGGER_GROUP)
  238. go
  239. alter table QRTZ_TRIGGER_LISTENERS
  240. add constraint PK_qrtz_trigger_listeners primary key clustered (TRIGGER_NAME, TRIGGER_GROUP, TRIGGER_LISTENER)
  241. go
  242. alter table QRTZ_TRIGGERS
  243. add constraint PK_qrtz_triggers primary key clustered (TRIGGER_NAME, TRIGGER_GROUP)
  244. go
  245. alter table QRTZ_BLOB_TRIGGERS
  246. add constraint PK_qrtz_blob_triggers primary key clustered (TRIGGER_NAME, TRIGGER_GROUP)
  247. go
  248. /*==============================================================================*/
  249. /* Create foreign key constraints: */
  250. /*==============================================================================*/
  251. alter table QRTZ_CRON_TRIGGERS
  252. add constraint FK_cron_triggers_triggers foreign key (TRIGGER_NAME,TRIGGER_GROUP)
  253. references QRTZ_TRIGGERS (TRIGGER_NAME,TRIGGER_GROUP)
  254. go
  255. alter table QRTZ_JOB_LISTENERS
  256. add constraint FK_job_listeners_job_details foreign key (JOB_NAME,JOB_GROUP)
  257. references QRTZ_JOB_DETAILS (JOB_NAME,JOB_GROUP)
  258. go
  259. alter table QRTZ_SIMPLE_TRIGGERS
  260. add constraint FK_simple_triggers_triggers foreign key (TRIGGER_NAME,TRIGGER_GROUP)
  261. references QRTZ_TRIGGERS (TRIGGER_NAME,TRIGGER_GROUP)
  262. go
  263. alter table QRTZ_TRIGGER_LISTENERS
  264. add constraint FK_trigger_listeners_triggers foreign key (TRIGGER_NAME,TRIGGER_GROUP)
  265. references QRTZ_TRIGGERS (TRIGGER_NAME,TRIGGER_GROUP)
  266. go
  267. alter table QRTZ_TRIGGERS
  268. add constraint FK_triggers_job_details foreign key (JOB_NAME,JOB_GROUP)
  269. references QRTZ_JOB_DETAILS (JOB_NAME,JOB_GROUP)
  270. go
  271. alter table QRTZ_BLOB_TRIGGERS
  272. add constraint FK_blob_triggers_triggers foreign key (TRIGGER_NAME,TRIGGER_GROUP)
  273. references QRTZ_TRIGGERS (TRIGGER_NAME,TRIGGER_GROUP)
  274. go
  275. /*==============================================================================*/
  276. /* End of script. */
  277. /*==============================================================================*/