msg_type.sql 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. -- -- create database if not exists `notice` default character set utf8 collate utf8_general_ci;
  2. DROP TABLE IF EXISTS `notice`.`message_type`;
  3. create table `notice`.`message_type`(
  4. `id` int(11) NOT NULL AUTO_INCREMENT comment '主键id',
  5. `sys_name` varchar(64) not null default '' comment '系统名称',
  6. `pasture_id` int(11) not null default 0 comment '牧场id',
  7. `service_id` int(11) unsigned not null 0 comment '服务id',
  8. `type_name` varchar(64) not null default '' comment '消息类型名称',
  9. `remind_type` int(11) not null default 0 comment '发送方式',
  10. `date_type` int(11) not null default 0 comment '循环类型',
  11. `cycle_type` int(11) not null default 0 comment '发送机制',
  12. `push_date` int(11) not null default 0 comment '推送日期',
  13. `push_time` varchar(64) not null default '' comment '推送时间',
  14. `delay_time` int(11) not null default 0 comment '延迟时间',
  15. `interval_time` int(11) not null default 0 comment '提醒间隔时间',
  16. `push_limit` int(11) not null default 0 comment '推送限制次数',
  17. `template_id` varchar(64) not null default '' comment '模板id',
  18. `status` int(11) not null default 0 comment '状态',
  19. `created_at` DATETIME not null default CURRENT_TIMESTAMP,
  20. `updated_at` DATETIME not null ON UPDATE CURRENT_TIMESTAMP ,
  21. primary key (`id`),
  22. UNIQUE index (`service_id`,`sys_name`,`pasture_id`),
  23. index (`remind_type`),
  24. index (`date_type`),
  25. index (`cycle_type`)
  26. )ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT '消息类型';
  27. -- show index from message_type;
  28. -- describe message_type;
  29. -- update message_type set remind_type =0;
  30. alter table message_type
  31. -- drop column delay_time,
  32. -- add `delay_time` int(11) not null default 0 comment '延迟时间' after push_time ;
  33. -- drop column create_at,
  34. -- drop column update_at,
  35. -- add status int(11) not null default 0 comment '状态';
  36. -- add `created_at` DATETIME not null default CURRENT_TIMESTAMP,
  37. -- add `updated_at` DATETIME not null ON UPDATE CURRENT_TIMESTAMP ;
  38. -- drop column remind_type_id,
  39. -- modify column remind_type int(11) unsigned not null default 0 comment '提醒类型id';
  40. -- modify date_type int(11) not null default 0,
  41. -- modify cycle_type int(11) not null default 0;
  42. -- drop column cycle_type ,
  43. -- add column cycle_type varchar(64) not null default '' AFTER interval_time;
  44. -- modify column `id` int(11) NOT NULL AUTO_INCREMENT before sys_name,
  45. -- modify column service_id int(11) unsigned not null default 0 before type_name,
  46. -- add unique key (`service_id`,`sys_name`,`pasture_id`);
  47. -- add primary key (`id`),
  48. -- modify push_date int(11) not null default 0;
  49. -- modify column `id` int(11) NOT NULL
  50. -- modify column `id` int(11) NOT NULL AUTO_INCREMENT;
  51. -- modify column `remind_type_id` int(11) unsigned not null default '0' FIRST remind_type;
  52. -- modify column `remind_type_id` int(11) FIRST remind_type
  53. -- drop index u_msg_type on message_type
  54. -- alter table message
  55. -- -- add push_count int(11) unsigned not null default '0' AFTER `status`;
  56. -- add remind_type_id int(11) unsigned not null default '0' AFTER `status`;
  57. -- insert into message_type
  58. -- (sys_name,id,pasture_id,type_name,remind_type_id,remind_type,push_date,push_time,interval_time,push_limit,template_id,roles_id,users_id)
  59. -- values
  60. -- -- ('tmrwatch',1,1,'合同金额超期未收',3,'指定周期','w1,w3,w5','9:30','0',3,'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo','1,2,3','1,2,3'),
  61. -- ('tmrwatch',2,3,'合同金额超期未收',3,'指定周期','w1,w3,w5','9:30','0',3,'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo','1,2,3','1,2,3'),
  62. -- ('tmrwatch',1,3,'合同金额超期未收',3,'指定周期','w1,w3,w5','9:30','0',3,'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo','1,2,3','1,2,3');
  63. -- ('tmrwatch','合同审批',1,'立即','0','0','2','0','BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo'),
  64. -- ('tmrwatch','客户回访未完成',2,'延时','48','9:30','24',3,'BtkN1rWKOJtKP0C64lGxIrPzLRFsYFas-4gupX2-pFo'),