init.sql 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. /*
  2. SQLyog Ultimate v12.08 (64 bit)
  3. MySQL - 5.7.19 : Database - kuangstudy
  4. *********************************************************************
  5. */
  6. /*!40101 SET NAMES utf8mb4 */;
  7. /*!40101 SET SQL_MODE=''*/;
  8. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  9. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  10. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  11. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  12. CREATE DATABASE /*!32312 IF NOT EXISTS*/`kuangstudy` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
  13. USE `bbs`;
  14. /*Table structure for table `ks_blog` */
  15. DROP TABLE IF EXISTS `ks_blog`;
  16. CREATE TABLE `ks_blog` (
  17. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  18. `bid` varchar(200) NOT NULL COMMENT '博客id',
  19. `title` varchar(200) NOT NULL COMMENT '博客标题',
  20. `content` longtext NOT NULL COMMENT '博客内容',
  21. `sort` int(1) NOT NULL DEFAULT '0' COMMENT '排序 0 普通 1 置顶',
  22. `views` int(10) NOT NULL DEFAULT '0' COMMENT '浏览量',
  23. `author_id` varchar(200) NOT NULL COMMENT '作者id',
  24. `author_name` varchar(200) NOT NULL COMMENT '作者名',
  25. `author_avatar` varchar(500) NOT NULL COMMENT '作者头像',
  26. `category_id` int(10) NOT NULL COMMENT '问题分类id',
  27. `category_name` varchar(50) NOT NULL COMMENT '问题分类名称',
  28. `gmt_create` datetime NOT NULL COMMENT '创建时间',
  29. `gmt_update` datetime NOT NULL COMMENT '修改时间',
  30. PRIMARY KEY (`id`)
  31. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
  32. /*Table structure for table `ks_blog_category` */
  33. DROP TABLE IF EXISTS `ks_blog_category`;
  34. CREATE TABLE `ks_blog_category` (
  35. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  36. `category` varchar(50) NOT NULL COMMENT '博客分类',
  37. PRIMARY KEY (`id`)
  38. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
  39. INSERT INTO `bbs`.`ks_blog_category` (`id`, `category`) VALUES (1, '交流');
  40. INSERT INTO `bbs`.`ks_blog_category` (`id`, `category`) VALUES (2, '答疑');
  41. INSERT INTO `bbs`.`ks_blog_category` (`id`, `category`) VALUES (3, '教程');
  42. /*Table structure for table `ks_comment` */
  43. DROP TABLE IF EXISTS `ks_comment`;
  44. CREATE TABLE `ks_comment` (
  45. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  46. `comment_id` varchar(200) NOT NULL COMMENT '评论唯一id',
  47. `topic_category` int(1) NOT NULL COMMENT '1博客 2问答',
  48. `topic_id` varchar(200) NOT NULL COMMENT '评论主题id',
  49. `user_id` varchar(200) NOT NULL COMMENT '评论者id',
  50. `user_name` varchar(200) NOT NULL COMMENT '评论者昵称',
  51. `user_avatar` varchar(500) NOT NULL COMMENT '评论者头像',
  52. `content` longtext NOT NULL COMMENT '评论内容',
  53. `gmt_create` datetime NOT NULL COMMENT '评论创建时间',
  54. PRIMARY KEY (`id`)
  55. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
  56. /*Table structure for table `ks_download` */
  57. DROP TABLE IF EXISTS `ks_download`;
  58. CREATE TABLE `ks_download` (
  59. `dname` varchar(100) NOT NULL COMMENT '资源名',
  60. `ddesc` varchar(500) NOT NULL COMMENT '资源链接',
  61. `dcode` varchar(50) NOT NULL COMMENT '提取码'
  62. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  63. /*Table structure for table `ks_invite` */
  64. DROP TABLE IF EXISTS `ks_invite`;
  65. CREATE TABLE `ks_invite` (
  66. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  67. `code` varchar(200) NOT NULL COMMENT '邀请码',
  68. `uid` varchar(200) DEFAULT NULL COMMENT '用户id',
  69. `status` int(1) NOT NULL DEFAULT '0' COMMENT '状态 0 未使用 1 使用',
  70. `active_time` datetime DEFAULT NULL COMMENT '激活时间',
  71. `gmt_create` datetime NOT NULL COMMENT '创建时间',
  72. PRIMARY KEY (`id`)
  73. ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
  74. /*Table structure for table `ks_question` */
  75. DROP TABLE IF EXISTS `ks_question`;
  76. CREATE TABLE `ks_question` (
  77. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  78. `qid` varchar(200) NOT NULL COMMENT '问题id',
  79. `title` varchar(200) NOT NULL COMMENT '问题标题',
  80. `content` longtext NOT NULL COMMENT '问题内容',
  81. `status` int(1) NOT NULL DEFAULT '0' COMMENT '状态 0 未解决 1 已解决',
  82. `sort` int(1) NOT NULL DEFAULT '0' COMMENT '排序 0 普通 1 置顶',
  83. `views` int(10) NOT NULL DEFAULT '0' COMMENT '浏览量',
  84. `author_id` varchar(200) NOT NULL COMMENT '作者id',
  85. `author_name` varchar(200) NOT NULL COMMENT '作者名',
  86. `author_avatar` varchar(500) NOT NULL COMMENT '作者头像',
  87. `category_id` int(10) NOT NULL COMMENT '问题分类id',
  88. `category_name` varchar(50) NOT NULL COMMENT '问题分类名称',
  89. `gmt_create` datetime NOT NULL COMMENT '创建时间',
  90. `gmt_update` datetime NOT NULL COMMENT '修改时间',
  91. PRIMARY KEY (`id`)
  92. ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
  93. /*Table structure for table `ks_question_category` */
  94. DROP TABLE IF EXISTS `ks_question_category`;
  95. CREATE TABLE `ks_question_category` (
  96. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  97. `category` varchar(50) NOT NULL COMMENT '问题分类',
  98. PRIMARY KEY (`id`)
  99. ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
  100. INSERT INTO `bbs`.`ks_question_category` (`id`, `category`) VALUES (1, '交流');
  101. INSERT INTO `bbs`.`ks_question_category` (`id`, `category`) VALUES (2, '答疑');
  102. INSERT INTO `bbs`.`ks_question_category` (`id`, `category`) VALUES (3, '教程');
  103. /*Table structure for table `ks_say` */
  104. DROP TABLE IF EXISTS `ks_say`;
  105. CREATE TABLE `ks_say` (
  106. `id` varchar(200) NOT NULL COMMENT '唯一id',
  107. `title` varchar(200) NOT NULL COMMENT '标题',
  108. `content` varchar(5000) NOT NULL COMMENT '内容',
  109. `gmt_create` datetime NOT NULL COMMENT '时间',
  110. PRIMARY KEY (`id`)
  111. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  112. /*Table structure for table `ks_user` */
  113. DROP TABLE IF EXISTS `ks_user`;
  114. CREATE TABLE `ks_user` (
  115. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
  116. `uid` varchar(200) NOT NULL COMMENT '用户编号',
  117. `role_id` int(10) NOT NULL COMMENT '角色编号',
  118. `username` varchar(100) NOT NULL COMMENT '用户名',
  119. `password` varchar(200) NOT NULL COMMENT '密码',
  120. `avatar` varchar(500) NOT NULL DEFAULT '/images/avatar/avatar-1.jpg' COMMENT '头像',
  121. `login_date` datetime NOT NULL COMMENT '登录时间',
  122. `gmt_create` datetime NOT NULL COMMENT '创建时间',
  123. PRIMARY KEY (`id`)
  124. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
  125. INSERT INTO `bbs`.`ks_user` (`id`, `uid`, `role_id`, `username`, `password`, `avatar`, `login_date`, `gmt_create`) VALUES (1, '1', 1, 'admin', '$2a$10$8D64nnnfqgNV5hwjzH6GouvpCnQ8LhwdDFNfDPJ1b8DLtq41E..5i', '/images/avatar/avatar-1.jpg', '2023-07-27 23:46:12', '2023-07-27 23:46:12');
  126. INSERT INTO `bbs`.`ks_user` (`id`, `uid`, `role_id`, `username`, `password`, `avatar`, `login_date`, `gmt_create`) VALUES (2, '91b2f1f959c4430ca86757b873c1f9b2', 2, 'test', '$2a$10$8D64nnnfqgNV5hwjzH6GouvpCnQ8LhwdDFNfDPJ1b8DLtq41E..5i', '/images/avatar/avatar-1.jpg', '2023-07-27 23:47:21', '2023-07-27 23:47:21');
  127. /*Table structure for table `ks_user_donate` */
  128. DROP TABLE IF EXISTS `ks_user_donate`;
  129. CREATE TABLE `ks_user_donate` (
  130. `uid` varchar(200) NOT NULL COMMENT '用户id',
  131. `donate_json` varchar(2000) NOT NULL COMMENT '赞赏二维码信息'
  132. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  133. /*Table structure for table `ks_user_info` */
  134. DROP TABLE IF EXISTS `ks_user_info`;
  135. CREATE TABLE `ks_user_info` (
  136. `uid` varchar(200) NOT NULL COMMENT '用户id',
  137. `nickname` varchar(80) DEFAULT NULL COMMENT '用户昵称',
  138. `realname` varchar(80) DEFAULT NULL COMMENT '真实姓名',
  139. `qq` varchar(20) DEFAULT NULL COMMENT 'QQ',
  140. `wechat` varchar(200) DEFAULT NULL COMMENT 'WeChat',
  141. `email` varchar(500) DEFAULT NULL COMMENT '邮箱',
  142. `phone` varchar(20) DEFAULT NULL COMMENT '手机',
  143. `work` varchar(200) DEFAULT NULL COMMENT '工作',
  144. `address` varchar(500) DEFAULT NULL COMMENT '地址',
  145. `hobby` varchar(500) DEFAULT NULL COMMENT '爱好',
  146. `intro` varchar(2000) DEFAULT NULL COMMENT '自我介绍'
  147. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
  148. /*Table structure for table `ks_user_role` */
  149. DROP TABLE IF EXISTS `ks_user_role`;
  150. CREATE TABLE `ks_user_role` (
  151. `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '角色编号',
  152. `name` varchar(200) NOT NULL COMMENT '角色名称',
  153. `description` varchar(500) NOT NULL DEFAULT '无描述...' COMMENT '角色描述',
  154. `gmt_create` datetime NOT NULL COMMENT '创建时间',
  155. PRIMARY KEY (`id`)
  156. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4;
  157. INSERT INTO `bbs`.`ks_user_role` (`id`, `name`, `description`, `gmt_create`) VALUES (1, 'admin', '管理员', '2023-07-27 23:46:07');
  158. INSERT INTO `bbs`.`ks_user_role` (`id`, `name`, `description`, `gmt_create`) VALUES (2, 'user', '用户', '2023-07-27 23:52:40');
  159. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  160. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  161. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  162. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;