1_schema.sql 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. -- MySQL dump 10.13 Distrib 5.7.24, for Linux (x86_64)
  2. --
  3. -- Host: 127.0.0.1 Database: goods_service
  4. -- ------------------------------------------------------
  5. -- Server version 5.7.24-log
  6. /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
  7. /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
  8. /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
  9. /*!40101 SET NAMES utf8 */;
  10. /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
  11. /*!40103 SET TIME_ZONE='+00:00' */;
  12. /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
  13. /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
  14. /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
  15. /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
  16. --
  17. -- Current Database: `goods_service`
  18. --
  19. CREATE DATABASE /*!32312 IF NOT EXISTS*/ `goods_service` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
  20. USE `goods_service`;
  21. --
  22. -- Table structure for table `ad`
  23. --
  24. DROP TABLE IF EXISTS `ad`;
  25. /*!40101 SET @saved_cs_client = @@character_set_client */;
  26. /*!40101 SET character_set_client = utf8 */;
  27. CREATE TABLE `ad` (
  28. `id` int(11) NOT NULL AUTO_INCREMENT,
  29. `name` varchar(60) DEFAULT '',
  30. `image_url` varchar(255) DEFAULT '',
  31. `link` varchar(255) DEFAULT '',
  32. `sort_order` int(11) DEFAULT '10',
  33. `enable` tinyint(1) DEFAULT '1',
  34. `create` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  35. PRIMARY KEY (`id`),
  36. KEY `enable` (`enable`)
  37. ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
  38. /*!40101 SET character_set_client = @saved_cs_client */;
  39. --
  40. -- Table structure for table `category`
  41. --
  42. DROP TABLE IF EXISTS `category`;
  43. /*!40101 SET @saved_cs_client = @@character_set_client */;
  44. /*!40101 SET character_set_client = utf8 */;
  45. CREATE TABLE `category` (
  46. `id` int(11) NOT NULL AUTO_INCREMENT,
  47. `name` varchar(30) DEFAULT '',
  48. `parent_id` int(11) DEFAULT '0',
  49. `icon_url` varchar(255) DEFAULT '',
  50. `sort_order` int(11) DEFAULT '50',
  51. PRIMARY KEY (`id`),
  52. KEY `parent_id` (`parent_id`)
  53. ) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8mb4;
  54. /*!40101 SET character_set_client = @saved_cs_client */;
  55. --
  56. -- Table structure for table `channel`
  57. --
  58. DROP TABLE IF EXISTS `channel`;
  59. /*!40101 SET @saved_cs_client = @@character_set_client */;
  60. /*!40101 SET character_set_client = utf8 */;
  61. CREATE TABLE `channel` (
  62. `id` int(11) NOT NULL AUTO_INCREMENT,
  63. `name` varchar(45) NOT NULL DEFAULT '',
  64. `url` varchar(255) NOT NULL DEFAULT '',
  65. `icon_url` varchar(255) NOT NULL DEFAULT '',
  66. `sort_order` int(4) unsigned NOT NULL DEFAULT '10',
  67. PRIMARY KEY (`id`)
  68. ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
  69. /*!40101 SET character_set_client = @saved_cs_client */;
  70. --
  71. -- Table structure for table `goods`
  72. --
  73. DROP TABLE IF EXISTS `goods`;
  74. /*!40101 SET @saved_cs_client = @@character_set_client */;
  75. /*!40101 SET character_set_client = utf8 */;
  76. CREATE TABLE `goods` (
  77. `id` int(11) NOT NULL AUTO_INCREMENT,
  78. `category_id` int(11) DEFAULT '0',
  79. `seller_id` varchar(32) DEFAULT '1',
  80. `buyer_id` varchar(32) DEFAULT '0',
  81. `name` varchar(100) DEFAULT '',
  82. `price` decimal(10,2) NOT NULL,
  83. `market_price` decimal(10,2) DEFAULT '0.00',
  84. `postage` decimal(10,2) DEFAULT '0.00',
  85. `primary_pic_url` varchar(255) DEFAULT '',
  86. `desc` text,
  87. `region_id` int(11) DEFAULT '403',
  88. `region` varchar(64) DEFAULT '北京 北京市 东城区',
  89. `want_count` int(11) DEFAULT '0',
  90. `browse_count` int(11) DEFAULT '0',
  91. `is_selling` tinyint(1) DEFAULT '1',
  92. `is_delete` tinyint(1) DEFAULT '0',
  93. `able_express` tinyint(1) DEFAULT '1',
  94. `able_meet` tinyint(1) DEFAULT '0',
  95. `able_self_take` tinyint(1) DEFAULT '0',
  96. `post_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  97. `last_edit` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  98. `sold_time` timestamp NULL DEFAULT NULL,
  99. PRIMARY KEY (`id`),
  100. KEY `category_id` (`category_id`),
  101. KEY `seller_id` (`seller_id`),
  102. KEY `buyer_id` (`buyer_id`)
  103. ) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=utf8mb4;
  104. /*!40101 SET character_set_client = @saved_cs_client */;
  105. --
  106. -- Table structure for table `goods_comment`
  107. --
  108. DROP TABLE IF EXISTS `goods_comment`;
  109. /*!40101 SET @saved_cs_client = @@character_set_client */;
  110. /*!40101 SET character_set_client = utf8 */;
  111. CREATE TABLE `goods_comment` (
  112. `id` int(11) NOT NULL AUTO_INCREMENT,
  113. `goods_id` int(11) DEFAULT '0',
  114. `user_id` varchar(32) DEFAULT '1',
  115. `reply_comment_id` int(11) DEFAULT '0',
  116. `reply_user_id` varchar(32) DEFAULT '0',
  117. `content` text,
  118. `is_delete` tinyint(1) DEFAULT '0',
  119. `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  120. PRIMARY KEY (`id`),
  121. KEY `goods_id` (`goods_id`),
  122. KEY `reply_comment_id` (`reply_comment_id`),
  123. KEY `user_id` (`user_id`),
  124. KEY `reply_user_id` (`reply_user_id`)
  125. ) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4;
  126. /*!40101 SET character_set_client = @saved_cs_client */;
  127. --
  128. -- Table structure for table `goods_gallery`
  129. --
  130. DROP TABLE IF EXISTS `goods_gallery`;
  131. /*!40101 SET @saved_cs_client = @@character_set_client */;
  132. /*!40101 SET character_set_client = utf8 */;
  133. CREATE TABLE `goods_gallery` (
  134. `id` int(11) NOT NULL AUTO_INCREMENT,
  135. `goods_id` int(11) DEFAULT '0',
  136. `img_url` varchar(255) DEFAULT '',
  137. PRIMARY KEY (`id`),
  138. KEY `goods_id` (`goods_id`)
  139. ) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8mb4;
  140. /*!40101 SET character_set_client = @saved_cs_client */;
  141. --
  142. -- Table structure for table `region`
  143. --
  144. DROP TABLE IF EXISTS `region`;
  145. /*!40101 SET @saved_cs_client = @@character_set_client */;
  146. /*!40101 SET character_set_client = utf8 */;
  147. CREATE TABLE `region` (
  148. `id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  149. `parent_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  150. `name` varchar(120) NOT NULL DEFAULT '',
  151. `type` tinyint(1) NOT NULL DEFAULT '2',
  152. `agency_id` smallint(5) unsigned NOT NULL DEFAULT '0',
  153. PRIMARY KEY (`id`),
  154. KEY `parent_id` (`parent_id`),
  155. KEY `region_type` (`type`),
  156. KEY `agency_id` (`agency_id`)
  157. ) ENGINE=InnoDB AUTO_INCREMENT=4044 DEFAULT CHARSET=utf8mb4;
  158. /*!40101 SET character_set_client = @saved_cs_client */;
  159. --
  160. -- Table structure for table `search_history`
  161. --
  162. DROP TABLE IF EXISTS `search_history`;
  163. /*!40101 SET @saved_cs_client = @@character_set_client */;
  164. /*!40101 SET character_set_client = utf8 */;
  165. CREATE TABLE `search_history` (
  166. `id` int(11) NOT NULL AUTO_INCREMENT,
  167. `user_id` varchar(32) DEFAULT '1',
  168. `keyword` varchar(65) DEFAULT '',
  169. `search_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  170. PRIMARY KEY (`id`),
  171. KEY `user_id` (`user_id`)
  172. ) ENGINE=InnoDB AUTO_INCREMENT=52 DEFAULT CHARSET=utf8mb4;
  173. /*!40101 SET character_set_client = @saved_cs_client */;
  174. --
  175. -- Table structure for table `user_preference`
  176. --
  177. DROP TABLE IF EXISTS `user_preference`;
  178. /*!40101 SET @saved_cs_client = @@character_set_client */;
  179. /*!40101 SET character_set_client = utf8 */;
  180. CREATE TABLE `user_preference` (
  181. `id` int(11) NOT NULL AUTO_INCREMENT,
  182. `goods_id` int(11) DEFAULT '0',
  183. `user_id` varchar(32) DEFAULT '0',
  184. `type` int(1) DEFAULT '0' COMMENT '1:收藏,2:想要',
  185. `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  186. PRIMARY KEY (`id`),
  187. KEY `user_id` (`user_id`),
  188. KEY `type` (`type`),
  189. KEY `goods_id` (`goods_id`)
  190. ) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4;
  191. /*!40101 SET character_set_client = @saved_cs_client */;
  192. --
  193. -- Current Database: `im_service`
  194. --
  195. CREATE DATABASE /*!32312 IF NOT EXISTS*/ `im_service` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
  196. USE `im_service`;
  197. --
  198. -- Table structure for table `chat`
  199. --
  200. DROP TABLE IF EXISTS `chat`;
  201. /*!40101 SET @saved_cs_client = @@character_set_client */;
  202. /*!40101 SET character_set_client = utf8 */;
  203. CREATE TABLE `chat` (
  204. `id` int(11) NOT NULL AUTO_INCREMENT,
  205. `u1` varchar(32) NOT NULL DEFAULT '',
  206. `u2` varchar(32) DEFAULT '' COMMENT 'u1 < u2',
  207. `goods_id` int(11) DEFAULT '0',
  208. `show_to_u1` tinyint(1) DEFAULT '1',
  209. `show_to_u2` tinyint(1) DEFAULT '1',
  210. PRIMARY KEY (`id`),
  211. KEY `u1` (`u1`),
  212. KEY `u2` (`u2`),
  213. KEY `goods_id` (`goods_id`)
  214. ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8mb4;
  215. /*!40101 SET character_set_client = @saved_cs_client */;
  216. --
  217. -- Table structure for table `history`
  218. --
  219. DROP TABLE IF EXISTS `history`;
  220. /*!40101 SET @saved_cs_client = @@character_set_client */;
  221. /*!40101 SET character_set_client = utf8 */;
  222. CREATE TABLE `history` (
  223. `id` int(11) NOT NULL AUTO_INCREMENT,
  224. `chat_id` int(11) DEFAULT '0',
  225. `u1_to_u2` tinyint(1) DEFAULT '0',
  226. `message_type` int(11) DEFAULT '1',
  227. `message_body` text,
  228. `send_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  229. PRIMARY KEY (`id`),
  230. KEY `chat_id` (`chat_id`),
  231. KEY `send_time` (`send_time`)
  232. ) ENGINE=InnoDB AUTO_INCREMENT=277 DEFAULT CHARSET=utf8mb4;
  233. /*!40101 SET character_set_client = @saved_cs_client */;
  234. --
  235. -- Current Database: `user_service`
  236. --
  237. CREATE DATABASE /*!32312 IF NOT EXISTS*/ `user_service` /*!40100 DEFAULT CHARACTER SET utf8mb4 */;
  238. USE `user_service`;
  239. --
  240. -- Table structure for table `user`
  241. --
  242. DROP TABLE IF EXISTS `user`;
  243. /*!40101 SET @saved_cs_client = @@character_set_client */;
  244. /*!40101 SET character_set_client = utf8 */;
  245. CREATE TABLE `user` (
  246. `id` int(11) NOT NULL AUTO_INCREMENT,
  247. `open_id` varchar(32) DEFAULT '0',
  248. `nick_name` varchar(32) DEFAULT '',
  249. `avatar_url` varchar(200) DEFAULT '',
  250. `gender` int(1) DEFAULT NULL,
  251. `country` varchar(16) DEFAULT NULL,
  252. `province` varchar(16) DEFAULT NULL,
  253. `city` varchar(16) DEFAULT NULL,
  254. `language` varchar(5) DEFAULT NULL,
  255. `register_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  256. PRIMARY KEY (`id`),
  257. UNIQUE KEY `user_open_id_uindex` (`open_id`),
  258. KEY `open_id` (`open_id`)
  259. ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8mb4;
  260. /*!40101 SET character_set_client = @saved_cs_client */;
  261. /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
  262. /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
  263. /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
  264. /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
  265. /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
  266. /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
  267. /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
  268. /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
  269. -- Dump completed on 2018-12-18 13:40:01