数据库设计 - 4.0.x

数据库建表语句仅供参考,一般不需要手动执行建表语句,蓝眼云盘在安装引导程序中会自动建表。



CREATE TABLE `tank40_bridge` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `share_uuid` char(36) DEFAULT NULL,
  `matter_uuid` char(36) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_dashboard` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `invoke_num` bigint(20) NOT NULL,
  `total_invoke_num` bigint(20) NOT NULL DEFAULT '0',
  `uv` bigint(20) NOT NULL DEFAULT '0',
  `total_uv` bigint(20) NOT NULL DEFAULT '0',
  `matter_num` bigint(20) NOT NULL DEFAULT '0',
  `total_matter_num` bigint(20) NOT NULL DEFAULT '0',
  `file_size` bigint(20) NOT NULL DEFAULT '0',
  `total_file_size` bigint(20) NOT NULL DEFAULT '0',
  `avg_cost` bigint(20) NOT NULL DEFAULT '0',
  `dt` varchar(45) NOT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `idx_dt` (`dt`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_download_token` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `user_uuid` char(36) NOT NULL,
  `matter_uuid` char(36) NOT NULL,
  `expire_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `ip` varchar(128) NOT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `idx_mu` (`matter_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_footprint` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `user_uuid` char(36) DEFAULT NULL,
  `ip` varchar(128) NOT NULL,
  `host` varchar(45) NOT NULL,
  `uri` varchar(255) NOT NULL,
  `params` text,
  `cost` bigint(20) NOT NULL DEFAULT '0',
  `success` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_image_cache` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `name` varchar(255) NOT NULL,
  `user_uuid` char(36) DEFAULT NULL,
  `username` varchar(45) NOT NULL,
  `matter_uuid` char(36) DEFAULT NULL,
  `matter_name` varchar(255) NOT NULL,
  `mode` varchar(512) DEFAULT NULL,
  `md5` varchar(45) DEFAULT NULL,
  `size` bigint(20) NOT NULL DEFAULT '0',
  `path` varchar(512) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `idx_mu` (`matter_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_matter` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `puuid` char(36) DEFAULT NULL,
  `user_uuid` char(36) DEFAULT NULL,
  `space_name` varchar(45) NOT NULL,
  `dir` tinyint(1) NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL,
  `md5` varchar(45) DEFAULT NULL,
  `size` bigint(20) NOT NULL DEFAULT '0',
  `privacy` tinyint(1) NOT NULL DEFAULT '0',
  `path` varchar(1024) DEFAULT NULL,
  `times` bigint(20) NOT NULL DEFAULT '0',
  `prop` varchar(1024) NOT NULL DEFAULT '{}',
  `visit_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `deleted` tinyint(1) NOT NULL DEFAULT '0',
  `delete_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `space_uuid` varchar(36) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `idx_delt` (`delete_time`),
  KEY `idx_puuid` (`puuid`),
  KEY `idx_uu` (`user_uuid`),
  KEY `idx_del` (`deleted`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_preference` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `name` varchar(45) DEFAULT NULL,
  `logo_url` varchar(255) DEFAULT NULL,
  `favicon_url` varchar(255) DEFAULT NULL,
  `copyright` varchar(1024) DEFAULT NULL,
  `record` varchar(1024) DEFAULT NULL,
  `download_dir_max_size` bigint(20) NOT NULL DEFAULT '-1',
  `download_dir_max_num` bigint(20) NOT NULL DEFAULT '-1',
  `default_total_size_limit` bigint(20) NOT NULL DEFAULT '-1',
  `allow_register` tinyint(1) NOT NULL DEFAULT '0',
  `preview_config` text,
  `scan_config` text,
  `deleted_keep_days` bigint(20) NOT NULL DEFAULT '7',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_session` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `user_uuid` char(36) DEFAULT NULL,
  `ip` varchar(128) NOT NULL,
  `expire_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_share` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `name` varchar(255) DEFAULT NULL,
  `share_type` varchar(45) DEFAULT NULL,
  `username` varchar(45) DEFAULT NULL,
  `user_uuid` char(36) DEFAULT NULL,
  `download_times` bigint(20) NOT NULL DEFAULT '0',
  `code` varchar(45) NOT NULL,
  `expire_infinity` tinyint(1) NOT NULL DEFAULT '0',
  `expire_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `space_uuid` char(36) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_space` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `user_uuid` char(36) DEFAULT NULL,
  `size_limit` bigint(20) DEFAULT NULL,
  `total_size_limit` bigint(20) DEFAULT NULL,
  `total_size` bigint(20) DEFAULT NULL,
  `name` varchar(100) DEFAULT NULL,
  `type` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`),
  KEY `idx_user_uuid` (`user_uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_space_member` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `space_uuid` char(36) DEFAULT NULL,
  `user_uuid` char(36) DEFAULT NULL,
  `space_role` varchar(45) DEFAULT NULL,
  `role` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_upload_token` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `user_uuid` char(36) NOT NULL,
  `folder_uuid` char(36) NOT NULL,
  `matter_uuid` char(36) NOT NULL,
  `expire_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `filename` varchar(255) NOT NULL,
  `privacy` tinyint(1) NOT NULL DEFAULT '0',
  `size` bigint(20) NOT NULL DEFAULT '0',
  `ip` varchar(128) NOT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4

CREATE TABLE `tank40_user` (
  `uuid` char(36) NOT NULL DEFAULT '',
  `sort` bigint(20) NOT NULL,
  `update_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `create_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `role` varchar(45) DEFAULT NULL,
  `username` varchar(45) NOT NULL,
  `password` varchar(255) DEFAULT NULL,
  `avatar_url` varchar(255) DEFAULT NULL,
  `last_ip` varchar(128) DEFAULT NULL,
  `last_time` timestamp NOT NULL DEFAULT '2018-01-01 00:00:00',
  `size_limit` bigint(20) NOT NULL DEFAULT '-1',
  `total_size_limit` bigint(20) NOT NULL DEFAULT '-1',
  `total_size` bigint(20) NOT NULL DEFAULT '0',
  `status` varchar(45) DEFAULT NULL,
  `space_uuid` char(36) DEFAULT NULL,
  PRIMARY KEY (`uuid`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `uuid` (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4


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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229

提示

4.0.x版本相较于3.1.x版本的差异:

matter表

  • 字段username替换成space_name
  • 新增字段space_uuid

share表

  • 新增字段space_uuid

space表

  • 新增表space

space_member表

  • 新增表space_member

user表

  • 新增字段space_uuid
  • 删除字段size_limit,total_size_limit,total_size
上次更新: 2023/7/9 上午1:21:22