install.sql 2.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. CREATE TABLE IF NOT EXISTS `__PREFIX__crontab` (
  2. `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'ID',
  3. `type` varchar(10) NOT NULL DEFAULT '' COMMENT '事件类型',
  4. `title` varchar(100) NOT NULL DEFAULT '' COMMENT '事件标题',
  5. `content` text NOT NULL COMMENT '事件内容',
  6. `schedule` varchar(100) NOT NULL DEFAULT '' COMMENT 'Crontab格式',
  7. `sleep` tinyint(1) UNSIGNED NOT NULL DEFAULT '0' COMMENT '延迟秒数执行',
  8. `maximums` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '最大执行次数 0为不限',
  9. `executes` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '已经执行的次数',
  10. `createtime` bigint(16) DEFAULT NULL COMMENT '创建时间',
  11. `updatetime` bigint(16) DEFAULT NULL COMMENT '更新时间',
  12. `begintime` bigint(16) DEFAULT NULL COMMENT '开始时间',
  13. `endtime` bigint(16) DEFAULT NULL COMMENT '结束时间',
  14. `executetime` bigint(16) DEFAULT NULL COMMENT '最后执行时间',
  15. `weigh` int(10) NOT NULL DEFAULT '0' COMMENT '权重',
  16. `status` enum('completed','expired','hidden','normal') NOT NULL DEFAULT 'normal' COMMENT '状态',
  17. PRIMARY KEY (`id`)
  18. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='定时任务表';
  19. BEGIN;
  20. INSERT INTO `__PREFIX__crontab` (`id`, `type`, `title`, `content`, `schedule`, `sleep`, `maximums`, `executes`, `createtime`, `updatetime`, `begintime`, `endtime`, `executetime`, `weigh`, `status`) VALUES
  21. (1, 'url', '请求百度', 'https://www.baidu.com', '* * * * *', 0, 0, 0, 1497070825, 1501253101, 1483200000, 1830268800, 1501253101, 1, 'normal'),
  22. (2, 'sql', '查询一条SQL', 'SELECT 1;', '* * * * *', 0, 0, 0, 1497071095, 1501253101, 1483200000, 1830268800, 1501253101, 2, 'normal');
  23. COMMIT;
  24. CREATE TABLE IF NOT EXISTS `__PREFIX__crontab_log` (
  25. `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  26. `crontab_id` int(10) DEFAULT NULL COMMENT '任务ID',
  27. `executetime` bigint(16) DEFAULT NULL COMMENT '执行时间',
  28. `completetime` bigint(16) DEFAULT NULL COMMENT '结束时间',
  29. `content` text COMMENT '执行结果',
  30. `status` enum('success','failure') DEFAULT 'failure' COMMENT '状态',
  31. PRIMARY KEY (`id`),
  32. KEY `crontab_id` (`crontab_id`)
  33. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='定时任务日志表';