activity_create.sql 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. drop table if exists offline_activity_info;
  2. create table offline_activity_info (
  3. id int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID,活动ID',
  4. title varchar(32) NOT NULL DEFAULT '' COMMENT '标题',
  5. link varchar(255) NOT NULL DEFAULT '' COMMENT '活动链接',
  6. bonus_type tinyint(4) NOT NULL DEFAULT 0 COMMENT '0,奖品;1,奖金',
  7. memo varchar(32) NOT NULL DEFAULT '' COMMENT '备注',
  8. creator varchar(16) NOT NULL DEFAULT '' COMMENT '创建者',
  9. state tinyint(4) NOT NULL DEFAULT 0 COMMENT '0初始;1发送中;2等待结果;10处理完成;100删除、无效',
  10. ctime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  11. mtime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  12. PRIMARY KEY (`id`),
  13. KEY `ix_mtime` (`mtime`)
  14. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='线下活动信息';
  15. drop table if exists offline_activity_bonus;
  16. create table offline_activity_bonus (
  17. id int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID, bonusID',
  18. activity_id int(11) unsigned NOT NULL DEFAULT 0 COMMENT '活动ID',
  19. total_money bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '奖项总金额,1=1/1000元',
  20. member_count int(11) unsigned NOT NULL DEFAULT 0 COMMENT '总人数',
  21. state tinyint(4) NOT NULL DEFAULT 0 COMMENT '0正常;100删除、无效',
  22. ctime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  23. mtime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  24. PRIMARY KEY (`id`),
  25. KEY `ix_mtime` (`mtime`)
  26. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='线下奖项信息';
  27. drop table if exists offline_activity_result;
  28. create table offline_activity_result (
  29. id int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  30. activity_id int(11) unsigned NOT NULL DEFAULT 0 COMMENT '活动ID',
  31. bonus_id int(11) unsigned NOT NULL DEFAULT 0 COMMENT '奖励ID',
  32. bonus_type tinyint(4) NOT NULL DEFAULT 0 COMMENT '0,奖品;1,奖金',
  33. mid int(11) unsigned NOT NULL DEFAULT 0 COMMENT 'memberID',
  34. state tinyint(4) NOT NULL DEFAULT 0 COMMENT '0初始;1审核中;10成功;11失败',
  35. bonus_money bigint(20) unsigned NOT NULL DEFAULT 0 COMMENT '奖励,1=1/1000元',
  36. order_id varchar(32) NOT NULL DEFAULT '' COMMENT '交易id,需要唯一',
  37. ctime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  38. mtime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  39. PRIMARY KEY (`id`),
  40. UNIQUE KEY `uk_aid_bid_mid` (activity_id, bonus_id, mid),
  41. KEY `ix_mid` (mid),
  42. KEY `ix_mtime` (`mtime`)
  43. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='线下活动奖励发放信息';
  44. drop table if exists offline_activity_shell_order;
  45. create table offline_activity_shell_order (
  46. id int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增ID',
  47. result_id int(11) unsigned NOT NULL COMMENT '对应的result ID',
  48. order_id varchar(32) NOT NULL DEFAULT '' COMMENT '交易id,需要唯一',
  49. order_status varchar(16) NOT NULL DEFAULT '' COMMENT '订单状态',
  50. ctime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '添加时间',
  51. mtime timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
  52. PRIMARY KEY (`id`),
  53. UNIQUE KEY `uk_order_id` (order_id),
  54. KEY `ix_mtime` (`mtime`)
  55. ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='贝壳订单';
  56. -- fat 1, uat 1, prod 1
  57. alter table offline_activity_info add key ix_ctime(ctime);
  58. alter table offline_activity_bonus add key ix_activity_id(activity_id);