bore_祭拜.sql 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. -- 用户祖先信息表
  2. CREATE TABLE `user_ancestor` (
  3. `ancestor_id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '祖先编号',
  4. `user_id` INT(11) UNSIGNED NOT NULL COMMENT '用户编号',
  5. `relation` VARCHAR(8) NOT NULL COMMENT '关系',
  6. `name` VARCHAR(8) NOT NULL COMMENT '姓名',
  7. `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  8. PRIMARY KEY (`ancestor_id`),
  9. KEY (`user_id`)
  10. ) ENGINE=InnoDB AUTO_INCREMENT=100001 DEFAULT CHARSET=utf8mb4 COMMENT='用户祖先信息表';
  11. -- 用户祭拜祖先信息表
  12. CREATE TABLE `prac_ancestor` (
  13. `prac_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '修行编号',
  14. `ancestor_id` INT(11) UNSIGNED NOT NULL COMMENT '祖先编号',
  15. `offering_types` VARCHAR(32) NOT NULL COMMENT '供品编号(#号分隔)',
  16. `back` VARCHAR(1024) DEFAULT NULL COMMENT '回向文',
  17. PRIMARY KEY (`prac_id`)
  18. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户祭拜祖先信息表';
  19. -- 内容诵经经书表
  20. CREATE TABLE `cont_scripture_read` (
  21. `scripture_read_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '诵经经书编号',
  22. `name` VARCHAR(32) NOT NULL COMMENT '名称',
  23. `author` VARCHAR(32) NOT NULL COMMENT '作者',
  24. `img_path` VARCHAR(256) DEFAULT NULL COMMENT '图片路径',
  25. `audio_path` VARCHAR(256) DEFAULT NULL COMMENT '音频路径',
  26. `content_path` VARCHAR(256) DEFAULT NULL COMMENT '歌词路径',
  27. `audio_sec` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '音频秒数',
  28. `read_count` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '诵读次数',
  29. `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  30. `update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  31. PRIMARY KEY (`scripture_read_id`)
  32. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='内容诵经经书表';
  33. -- 用户诵经信息表
  34. CREATE TABLE `prac_scripture_read` (
  35. `prac_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '修行编号',
  36. `scripture_read_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '诵经经书编号',
  37. `audio_path` VARCHAR(256) NOT NULL COMMENT '音频路径',
  38. `back` VARCHAR(1024) DEFAULT NULL COMMENT '回向文',
  39. PRIMARY KEY (`prac_id`)
  40. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户诵经信息表';
  41. -- 内容抄经经书表
  42. CREATE TABLE `cont_scripture_write` (
  43. `scripture_write_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '抄经经书编号',
  44. `name` VARCHAR(64) NOT NULL COMMENT '经书名称',
  45. `img_path` VARCHAR(256) DEFAULT NULL COMMENT '经书图片',
  46. `content_path` VARCHAR(256) DEFAULT NULL COMMENT '经书原文路径',
  47. `word_num` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '字数',
  48. `write_count` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '抄写次数',
  49. `create_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  50. `update_time` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  51. PRIMARY KEY (`scripture_write_id`)
  52. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='内容抄经经书表';
  53. -- 用户抄经信息表
  54. CREATE TABLE `prac_write_scripture` (
  55. `prac_id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '修行编号',
  56. `scripture_write_id` BIGINT(20) UNSIGNED NOT NULL COMMENT '抄经经书编号',
  57. `img_path` VARCHAR(256) NOT NULL COMMENT '图片路径',
  58. `back` VARCHAR(1024) DEFAULT NULL COMMENT '回向文',
  59. PRIMARY KEY (`prac_id`)
  60. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户抄经信息表';
  61. ALTER TABLE `cont_scripture` add COLUMN `scripture_write_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT '抄经书编号' AFTER `view_count`;
  62. ALTER TABLE `cont_scripture` add COLUMN `scripture_read_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT '诵经书编号' AFTER `scripture_write_id`;
  63. ALTER TABLE `user_prac_ext` add COLUMN `scripture_read_count` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '诵经次数' AFTER `repent_count`;
  64. ALTER TABLE `user_prac_ext` add COLUMN `scripture_read_sec` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '诵经时长(秒数)' AFTER `scripture_read_count`;
  65. ALTER TABLE `user_prac_ext` add COLUMN `scripture_write_count` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '抄经次数' AFTER `scripture_read_sec`;
  66. ALTER TABLE `user_prac_ext` add COLUMN `scripture_write_word_num` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '抄经字数' AFTER `scripture_write_count`;
  67. ALTER TABLE `user_prac_ext` add COLUMN `ancestor_count` INT(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '祭拜祖先次数' AFTER `scripture_write_word_num`;
  68. ALTER TABLE `user` add COLUMN `openid` VARCHAR(48) DEFAULT NULL COMMENT '微信openid' AFTER `phone`;
  69. ALTER TABLE `user` ADD UNIQUE (`openid` );
  70. ALTER TABLE `user` ADD INDEX (`nick_name` );
  71. ALTER TABLE `stats_event` add COLUMN `user_id` INT(11) UNSIGNED DEFAULT 0 COMMENT '分享用户编号' AFTER `user_flag`;