-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfileServer.sql
76 lines (71 loc) · 4.54 KB
/
fileServer.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for tbl_file
-- ----------------------------
DROP TABLE IF EXISTS `tbl_file`;
CREATE TABLE `tbl_file` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`file_sha1` char(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件hash',
`file_name` varchar(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件名',
`file_size` bigint(20) NULL DEFAULT 0 COMMENT '文件大小',
`file_addr` varchar(1024) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '文件存储位置',
`create_at` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
`update_at` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新日期',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '状态(可用/禁用/已删除等状态)',
`ext1` int(11) NULL DEFAULT 0 COMMENT '备用字段1',
`ext2` text CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备用字段2',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `idx_file_hash`(`file_sha1`) USING BTREE,
INDEX `idx_status`(`status`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tbl_user
-- ----------------------------
DROP TABLE IF EXISTS `tbl_user`;
CREATE TABLE `tbl_user` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '用户名',
`user_pwd` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '用户encoded密码',
`email` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '邮箱',
`phone` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '手机号',
`email_validated` tinyint(1) NULL DEFAULT 0 COMMENT '邮箱是否已验证',
`phone_validated` tinyint(1) NULL DEFAULT 0 COMMENT '手机号是否已验证',
`signup_at` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '注册日期',
`last_active` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后活跃时间戳',
`profile` text CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL COMMENT '用户属性',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '账户状态(启用/禁用/锁定/标记删除等)',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `idx_username`(`user_name`) USING BTREE,
INDEX `idx_status`(`status`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tbl_user_file
-- ----------------------------
DROP TABLE IF EXISTS `tbl_user_file`;
CREATE TABLE `tbl_user_file` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL,
`file_sha1` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '文件hash',
`file_size` bigint(20) NULL DEFAULT 0 COMMENT '文件大小',
`file_name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '文件名',
`upload_at` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP COMMENT '上传时间',
`last_update` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '最后修改时间',
`status` int(11) NOT NULL DEFAULT 0 COMMENT '文件状态(0正常1已删除2禁用)',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `idx_user_file`(`user_name`, `file_sha1`) USING BTREE,
INDEX `idx_status`(`status`) USING BTREE,
INDEX `idx_user_id`(`user_name`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for tbl_user_token
-- ----------------------------
DROP TABLE IF EXISTS `tbl_user_token`;
CREATE TABLE `tbl_user_token` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_name` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '用户名',
`user_token` char(40) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '用户登录token',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `idx_username`(`user_name`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
SET FOREIGN_KEY_CHECKS = 1;