DROP TABLE IF EXISTS QRTZ_FIRED_TRIGGERS; DROP TABLE IF EXISTS QRTZ_PAUSED_TRIGGER_GRPS; DROP TABLE IF EXISTS QRTZ_SCHEDULER_STATE; DROP TABLE IF EXISTS QRTZ_LOCKS; DROP TABLE IF EXISTS QRTZ_SIMPLE_TRIGGERS; DROP TABLE IF EXISTS QRTZ_SIMPROP_TRIGGERS; DROP TABLE IF EXISTS QRTZ_CRON_TRIGGERS; DROP TABLE IF EXISTS QRTZ_BLOB_TRIGGERS; DROP TABLE IF EXISTS QRTZ_TRIGGERS; DROP TABLE IF EXISTS QRTZ_JOB_DETAILS; DROP TABLE IF EXISTS QRTZ_CALENDARS; -- ---------------------------- -- 1ã€å˜å‚¨æ¯ä¸€ä¸ªå·²é…置的 jobDetail çš„è¯¦ç»†ä¿¡æ¯ -- ---------------------------- create table QRTZ_JOB_DETAILS ( sched_name varchar(120) not null comment '调度å称', job_name varchar(200) not null comment '任务å称', job_group varchar(200) not null comment '任务组å', description varchar(250) null comment '相关介ç»', job_class_name varchar(250) not null comment '执行任务类å称', is_durable varchar(1) not null comment '是å¦æŒä¹…化', is_nonconcurrent varchar(1) not null comment '是å¦å¹¶å‘', is_update_data varchar(1) not null comment '是å¦æ›´æ–°æ•°æ®', requests_recovery varchar(1) not null comment '是å¦æŽ¥å—æ¢å¤æ‰§è¡Œ', job_data blob null comment 'å˜æ”¾æŒä¹…化job对象', primary key (sched_name, job_name, job_group) ) engine=innodb comment = '任务详细信æ¯è¡¨'; -- ---------------------------- -- 2〠å˜å‚¨å·²é…置的 Trigger çš„ä¿¡æ¯ -- ---------------------------- create table QRTZ_TRIGGERS ( sched_name varchar(120) not null comment '调度å称', trigger_name varchar(200) not null comment '触å‘器的åå—', trigger_group varchar(200) not null comment '触å‘器所属组的åå—', job_name varchar(200) not null comment 'qrtz_job_details表job_name的外键', job_group varchar(200) not null comment 'qrtz_job_details表job_group的外键', description varchar(250) null comment '相关介ç»', next_fire_time bigint(13) null comment '上一次触å‘时间(毫秒)', prev_fire_time bigint(13) null comment '下一次触å‘时间(默认为-1表示ä¸è§¦å‘)', priority integer null comment '优先级', trigger_state varchar(16) not null comment '触å‘器状æ€', trigger_type varchar(8) not null comment '触å‘器的类型', start_time bigint(13) not null comment '开始时间', end_time bigint(13) null comment '结æŸæ—¶é—´', calendar_name varchar(200) null comment '日程表å称', misfire_instr smallint(2) null comment 'è¡¥å¿æ‰§è¡Œçš„ç–ç•¥', job_data blob null comment 'å˜æ”¾æŒä¹…化job对象', primary key (sched_name, trigger_name, trigger_group), foreign key (sched_name, job_name, job_group) references QRTZ_JOB_DETAILS(sched_name, job_name, job_group) ) engine=innodb comment = '触å‘器详细信æ¯è¡¨'; -- ---------------------------- -- 3〠å˜å‚¨ç®€å•çš„ Trigger,包括é‡å¤æ¬¡æ•°ï¼Œé—´éš”,以åŠå·²è§¦å‘的次数 -- ---------------------------- create table QRTZ_SIMPLE_TRIGGERS ( sched_name varchar(120) not null comment '调度å称', trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', repeat_count bigint(7) not null comment 'é‡å¤çš„次数统计', repeat_interval bigint(12) not null comment 'é‡å¤çš„间隔时间', times_triggered bigint(10) not null comment 'å·²ç»è§¦å‘的次数', primary key (sched_name, trigger_name, trigger_group), foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) ) engine=innodb comment = '简å•è§¦å‘器的信æ¯è¡¨'; -- ---------------------------- -- 4〠å˜å‚¨ Cron Trigger,包括 Cron 表达å¼å’Œæ—¶åŒºä¿¡æ¯ -- ---------------------------- create table QRTZ_CRON_TRIGGERS ( sched_name varchar(120) not null comment '调度å称', trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', cron_expression varchar(200) not null comment 'cron表达å¼', time_zone_id varchar(80) comment '时区', primary key (sched_name, trigger_name, trigger_group), foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) ) engine=innodb comment = 'Cron类型的触å‘器表'; -- ---------------------------- -- 5〠Trigger 作为 Blob 类型å˜å‚¨(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型,JobStore 并ä¸çŸ¥é“如何å˜å‚¨å®žä¾‹çš„时候) -- ---------------------------- create table QRTZ_BLOB_TRIGGERS ( sched_name varchar(120) not null comment '调度å称', trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', blob_data blob null comment 'å˜æ”¾æŒä¹…化Trigger对象', primary key (sched_name, trigger_name, trigger_group), foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) ) engine=innodb comment = 'Blob类型的触å‘器表'; -- ---------------------------- -- 6〠以 Blob 类型å˜å‚¨å˜æ”¾æ—¥åŽ†ä¿¡æ¯ï¼Œ quartzå¯é…置一个日历æ¥æŒ‡å®šä¸€ä¸ªæ—¶é—´èŒƒå›´ -- ---------------------------- create table QRTZ_CALENDARS ( sched_name varchar(120) not null comment '调度å称', calendar_name varchar(200) not null comment '日历å称', calendar blob not null comment 'å˜æ”¾æŒä¹…化calendar对象', primary key (sched_name, calendar_name) ) engine=innodb comment = '日历信æ¯è¡¨'; -- ---------------------------- -- 7〠å˜å‚¨å·²æš‚åœçš„ Trigger ç»„çš„ä¿¡æ¯ -- ---------------------------- create table QRTZ_PAUSED_TRIGGER_GRPS ( sched_name varchar(120) not null comment '调度å称', trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', primary key (sched_name, trigger_group) ) engine=innodb comment = 'æš‚åœçš„触å‘器表'; -- ---------------------------- -- 8〠å˜å‚¨ä¸Žå·²è§¦å‘çš„ Trigger 相关的状æ€ä¿¡æ¯ï¼Œä»¥åŠç›¸è” Job çš„æ‰§è¡Œä¿¡æ¯ -- ---------------------------- create table QRTZ_FIRED_TRIGGERS ( sched_name varchar(120) not null comment '调度å称', entry_id varchar(95) not null comment '调度器实例id', trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', instance_name varchar(200) not null comment '调度器实例å', fired_time bigint(13) not null comment '触å‘的时间', sched_time bigint(13) not null comment '定时器制定的时间', priority integer not null comment '优先级', state varchar(16) not null comment '状æ€', job_name varchar(200) null comment '任务å称', job_group varchar(200) null comment '任务组å', is_nonconcurrent varchar(1) null comment '是å¦å¹¶å‘', requests_recovery varchar(1) null comment '是å¦æŽ¥å—æ¢å¤æ‰§è¡Œ', primary key (sched_name, entry_id) ) engine=innodb comment = '已触å‘的触å‘器表'; -- ---------------------------- -- 9〠å˜å‚¨å°‘é‡çš„有关 Scheduler 的状æ€ä¿¡æ¯ï¼Œå‡å¦‚是用于集群ä¸ï¼Œå¯ä»¥çœ‹åˆ°å…¶ä»–çš„ Scheduler 实例 -- ---------------------------- create table QRTZ_SCHEDULER_STATE ( sched_name varchar(120) not null comment '调度å称', instance_name varchar(200) not null comment '实例å称', last_checkin_time bigint(13) not null comment '上次检查时间', checkin_interval bigint(13) not null comment '检查间隔时间', primary key (sched_name, instance_name) ) engine=innodb comment = '调度器状æ€è¡¨'; -- ---------------------------- -- 10〠å˜å‚¨ç¨‹åºçš„悲观é”çš„ä¿¡æ¯(å‡å¦‚使用了悲观é”) -- ---------------------------- create table QRTZ_LOCKS ( sched_name varchar(120) not null comment '调度å称', lock_name varchar(40) not null comment '悲观é”å称', primary key (sched_name, lock_name) ) engine=innodb comment = 'å˜å‚¨çš„悲观é”ä¿¡æ¯è¡¨'; -- ---------------------------- -- 11〠Quartz集群实现åŒæ¥æœºåˆ¶çš„è¡Œé”表 -- ---------------------------- create table QRTZ_SIMPROP_TRIGGERS ( sched_name varchar(120) not null comment '调度å称', trigger_name varchar(200) not null comment 'qrtz_triggers表trigger_name的外键', trigger_group varchar(200) not null comment 'qrtz_triggers表trigger_group的外键', str_prop_1 varchar(512) null comment 'String类型的trigger的第一个å‚æ•°', str_prop_2 varchar(512) null comment 'String类型的trigger的第二个å‚æ•°', str_prop_3 varchar(512) null comment 'String类型的trigger的第三个å‚æ•°', int_prop_1 int null comment 'int类型的trigger的第一个å‚æ•°', int_prop_2 int null comment 'int类型的trigger的第二个å‚æ•°', long_prop_1 bigint null comment 'long类型的trigger的第一个å‚æ•°', long_prop_2 bigint null comment 'long类型的trigger的第二个å‚æ•°', dec_prop_1 numeric(13,4) null comment 'decimal类型的trigger的第一个å‚æ•°', dec_prop_2 numeric(13,4) null comment 'decimal类型的trigger的第二个å‚æ•°', bool_prop_1 varchar(1) null comment 'Boolean类型的trigger的第一个å‚æ•°', bool_prop_2 varchar(1) null comment 'Boolean类型的trigger的第二个å‚æ•°', primary key (sched_name, trigger_name, trigger_group), foreign key (sched_name, trigger_name, trigger_group) references QRTZ_TRIGGERS(sched_name, trigger_name, trigger_group) ) engine=innodb comment = 'åŒæ¥æœºåˆ¶çš„è¡Œé”表'; commit;