ludu-cloud/docs/sql/mall_user.sql
2019-07-02 23:47:52 +08:00

151 lines
6.2 KiB
SQL

/*
Navicat Premium Data Transfer
Source Server : mall_mysql
Source Server Type : MySQL
Source Server Version : 50726
Source Host : 180.167.213.26:13306
Source Schema : mall_user
Target Server Type : MySQL
Target Server Version : 50726
File Encoding : 65001
Date: 05/06/2019 07:58:03
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for mobile_code
-- ----------------------------
DROP TABLE IF EXISTS `mobile_code`;
CREATE TABLE `mobile_code` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`mobile` varchar(11) NOT NULL,
`code` varchar(6) NOT NULL,
`today_index` tinyint(4) NOT NULL,
`used` tinyint(4) NOT NULL,
`used_user_id` int(20) DEFAULT NULL,
`used_time` datetime DEFAULT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=236 DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for oauth2_access_token
-- ----------------------------
DROP TABLE IF EXISTS `oauth2_access_token`;
CREATE TABLE `oauth2_access_token` (
`id` varchar(32) NOT NULL,
`refresh_token` varchar(32) DEFAULT NULL,
`user_id` int(20) DEFAULT NULL,
`valid` tinyint(4) DEFAULT NULL,
`expires_time` datetime DEFAULT NULL,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_uid` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for oauth2_refresh_token
-- ----------------------------
DROP TABLE IF EXISTS `oauth2_refresh_token`;
CREATE TABLE `oauth2_refresh_token` (
`id` varchar(32) NOT NULL,
`user_id` int(20) DEFAULT NULL,
`valid` tinyint(4) DEFAULT NULL,
`expires_time` datetime DEFAULT NULL,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`) USING BTREE,
KEY `idx_uid` (`user_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for user_access_log
-- ----------------------------
DROP TABLE IF EXISTS `user_access_log`;
CREATE TABLE `user_access_log` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '编号',
`user_id` int(11) NOT NULL DEFAULT '-1' COMMENT '管理员编号.',
`uri` varchar(4096) NOT NULL DEFAULT '' COMMENT '访问地址',
`query_string` varchar(4096) NOT NULL DEFAULT '' COMMENT '参数',
`method` varchar(50) NOT NULL DEFAULT '' COMMENT 'http 方法',
`user_agent` varchar(1024) NOT NULL DEFAULT '' COMMENT 'userAgent',
`ip` varchar(50) NOT NULL DEFAULT '' COMMENT 'ip',
`start_time` datetime NOT NULL COMMENT '请求时间',
`response_time` int(11) NOT NULL COMMENT '响应时长 -- 毫秒级',
`create_time` datetime NOT NULL COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10579 DEFAULT CHARSET=utf8mb4 COMMENT='admin_access_log';
-- ----------------------------
-- Table structure for user_address
-- ----------------------------
DROP TABLE IF EXISTS `user_address`;
CREATE TABLE `user_address` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL COMMENT '用户编号',
`area_no` varchar(10) COLLATE utf8mb4_bin NOT NULL COMMENT '区域编号',
`name` varchar(10) COLLATE utf8mb4_bin NOT NULL COMMENT '收件人名称',
`mobile` varchar(20) COLLATE utf8mb4_bin NOT NULL COMMENT '手机号',
`address` varchar(250) COLLATE utf8mb4_bin NOT NULL COMMENT '详细地址',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`has_default` int(1) NOT NULL COMMENT '是否默认',
`deleted` int(2) NOT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for user_register
-- ----------------------------
DROP TABLE IF EXISTS `user_register`;
CREATE TABLE `user_register` (
`id` int(20) NOT NULL,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`udpate_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- ----------------------------
-- Table structure for users
-- ----------------------------
DROP TABLE IF EXISTS `users`;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
`mobile` varchar(11) COLLATE utf8mb4_bin NOT NULL,
`nickname` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '昵称',
`avatar` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '头像',
`status` tinyint(4) DEFAULT NULL COMMENT '状态',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP,
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE KEY `idx_uid` (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-- ----------------------------
-- Table structure for user_spu_collections
-- ----------------------------
DROP TABLE IF EXISTS `user_spu_collections`;
CREATE TABLE `user_spu_collections` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id自增长',
`user_id` int(11) NOT NULL COMMENT '用户id',
`nickname` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '用户名称',
`spu_id` int(11) NOT NULL COMMENT '商品id',
`spu_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '商品名字',
`spu_image` varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '图片名字',
`create_time` datetime(0) NOT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
`deleted` smallint(2) NOT NULL COMMENT '删除状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '用户_商品_收藏记录表' ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;