-
Notifications
You must be signed in to change notification settings - Fork 0
/
HOT.sql
359 lines (340 loc) · 14.3 KB
/
HOT.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
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
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
CREATE DATABASE hot
CHARACTER SET utf8mb4
COLLATE utf8mb4_unicode_ci;
use hot;
## Tables
# user
CREATE TABLE IF NOT EXISTS `user` (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`address` LONGTEXT DEFAULT NULL,
`location` TEXT DEFAULT NULL,
`phone` TEXT DEFAULT NULL,
`gender` TEXT DEFAULT NULL,
`status` LONGTEXT DEFAULT NULL,
`authorized_id` INT UNIQUE DEFAULT NULL,
`board_id` MEDIUMTEXT DEFAULT NULL,
`user_device_id` MEDIUMTEXT DEFAULT NULL,
`preferences` LONGTEXT DEFAULT NULL,
`scopes` LONGTEXT DEFAULT NULL,
`is_deleted` TINYINT DEFAULT b'0',
`is_activated` TINYINT DEFAULT b'0',
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# user_device
CREATE TABLE IF NOT EXISTS user_device (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`description` LONGTEXT DEFAULT NULL,
`model` TEXT NOT NULL,
`manufacturer` TEXT DEFAULT NULL,
`version` TEXT NOT NULL,
`firmware` TEXT DEFAULT NULL,
`os` TEXT DEFAULT NULL,
`user_id` INT NOT NULL,
`board_id` MEDIUMTEXT DEFAULT NULL,
`status` LONGTEXT DEFAULT NULL,
`authorized_id` INT UNIQUE DEFAULT NULL,
`configuration` LONGTEXT DEFAULT NULL,
`scopes` LONGTEXT DEFAULT NULL,
`push_registration_token` MEDIUMTEXT DEFAULT NULL,
`is_deleted` TINYINT DEFAULT b'0',
`is_activated` TINYINT DEFAULT b'0',
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# device
CREATE TABLE IF NOT EXISTS device (
id INT NOT NULL AUTO_INCREMENT,
`model` TEXT NOT NULL,
`manufacturer` TEXT DEFAULT NULL,
`version` TEXT NOT NULL,
`firmware` TEXT DEFAULT NULL,
`os` TEXT DEFAULT NULL,
`image` MEDIUMTEXT DEFAULT NULL,
`configuration` LONGTEXT DEFAULT NULL,
`scopes` LONGTEXT DEFAULT NULL,
`is_deleted` TINYINT DEFAULT b'0',
`is_activated` TINYINT DEFAULT b'0',
PRIMARY KEY (id)
)
ENGINE = INNODB;
# server_configuration
CREATE TABLE IF NOT EXISTS server_configuration (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`description` LONGTEXT DEFAULT NULL,
`status` LONGTEXT DEFAULT NULL,
`authorized_id` INT UNIQUE DEFAULT NULL,
`configuration` LONGTEXT DEFAULT NULL,
`scopes` LONGTEXT DEFAULT NULL,
`is_deleted` TINYINT DEFAULT b'0',
`is_activated` TINYINT DEFAULT b'0',
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# board_configuration
CREATE TABLE IF NOT EXISTS board_configuration (
id INT NOT NULL AUTO_INCREMENT,
`board_id` INT NOT NULL,
`server_configuration_id` INT NOT NULL,
`user_device_id` MEDIUMTEXT DEFAULT NULL,
`user_id` MEDIUMTEXT DEFAULT NULL,
`topos` LONGTEXT DEFAULT NULL,
`status` LONGTEXT DEFAULT NULL,
`authorized_id` INT UNIQUE DEFAULT NULL,
`configuration` LONGTEXT DEFAULT NULL,
`scopes` LONGTEXT DEFAULT NULL,
`is_deleted` TINYINT DEFAULT b'0',
`is_activated` TINYINT DEFAULT b'0',
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# board
CREATE TABLE IF NOT EXISTS board (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`description` LONGTEXT DEFAULT NULL,
`model` TEXT NOT NULL,
`manufacturer` TEXT DEFAULT NULL,
`version` TEXT NOT NULL,
`firmware` TEXT DEFAULT NULL,
`os` TEXT DEFAULT NULL,
`image` MEDIUMTEXT DEFAULT NULL,
`sensors` LONGTEXT DEFAULT NULL,
`boards` LONGTEXT DEFAULT NULL,
`public_contacts` LONGTEXT DEFAULT NULL,
`internal_contacts` LONGTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# sensor
CREATE TABLE IF NOT EXISTS sensor (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT NOT NULL,
`description` LONGTEXT DEFAULT NULL,
`model` TEXT NOT NULL,
`manufacturer` TEXT DEFAULT NULL,
`version` TEXT NOT NULL,
`firmware` TEXT DEFAULT NULL,
`image` MEDIUMTEXT DEFAULT NULL,
`public_contacts` LONGTEXT DEFAULT NULL,
`internal_contacts` LONGTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# topo
CREATE TABLE IF NOT EXISTS topo (
id INT NOT NULL AUTO_INCREMENT,
`board_internal_contact` MEDIUMTEXT DEFAULT NULL,
`sensor_internal_contact` MEDIUMTEXT DEFAULT NULL,
`description` MEDIUMTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# contact
CREATE TABLE IF NOT EXISTS contact (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT DEFAULT NULL,
`io` INT NOT NULL,
`input_ad` INT NOT NULL,
`output_ad` INT NOT NULL,
`max_input` DOUBLE NOT NULL,
`min_input` DOUBLE NOT NULL,
`max_output` DOUBLE NOT NULL,
`min_output` DOUBLE NOT NULL,
`frequency` BIGINT DEFAULT NULL,
`wave_shape` INT DEFAULT NULL,
`input_oscillation_function` LONGTEXT DEFAULT NULL,
`output_oscillation_function` LONGTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# uri
CREATE TABLE IF NOT EXISTS uri (
id INT NOT NULL AUTO_INCREMENT,
`representation` MEDIUMTEXT NOT NULL,
`content` LONGTEXT DEFAULT NULL,
`virtual_address` MEDIUMTEXT DEFAULT NULL,
`physical_address` MEDIUMTEXT DEFAULT NULL,
`authorized_id` INT UNIQUE DEFAULT NULL,
`scopes` TEXT DEFAULT NULL,
`type` TEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# scope
CREATE TABLE IF NOT EXISTS scope (
id INT NOT NULL AUTO_INCREMENT,
`scope_pair` TEXT NOT NULL,
`description` MEDIUMTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# scope_definition
CREATE TABLE IF NOT EXISTS scope_definition (
id INT NOT NULL AUTO_INCREMENT,
`level` TEXT NOT NULL,
`order` INT NOT NULL,
`actions` TEXT DEFAULT NULL,
`description` MEDIUMTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# log
CREATE TABLE IF NOT EXISTS log (
id INT NOT NULL AUTO_INCREMENT,
`content` LONGTEXT DEFAULT NULL,
`configuration` INT NOT NULL,
`type` TEXT NOT NULL,
`level` INT NOT NULL,
`scopes` TEXT DEFAULT NULL,
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# category
CREATE TABLE IF NOT EXISTS category (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT DEFAULT NULL,
`description` LONGTEXT DEFAULT NULL,
`map` LONGTEXT DEFAULT NULL,
`statistics` LONGTEXT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# configuration
CREATE TABLE IF NOT EXISTS configuration (
id INT NOT NULL AUTO_INCREMENT,
`files` LONGTEXT DEFAULT NULL,
`uris` LONGTEXT DEFAULT NULL,
`strings` LONGTEXT DEFAULT NULL,
`binary` LONGBLOB DEFAULT NULL,
`update_order` VARCHAR(256) NOT NULL,
`type` INT NOT NULL,
`scopes` VARCHAR(256) DEFAULT NULL,
`category` VARCHAR(256) DEFAULT NULL,
`is_deleted` TINYINT DEFAULT b'0',
`is_activated` TINYINT DEFAULT b'0',
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# authorization
CREATE TABLE IF NOT EXISTS authorization (
id INT NOT NULL AUTO_INCREMENT,
`name` TEXT DEFAULT NULL,
`uuid` VARCHAR(256) UNIQUE NOT NULL,
`authorized_code` TEXT NOT NULL,
`tokens` LONGTEXT DEFAULT NULL,
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`last_updated_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP
ON UPDATE CURRENT_TIMESTAMP,
`expired_interval` INT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# token
CREATE TABLE IF NOT EXISTS token (
id INT NOT NULL AUTO_INCREMENT,
`authorized_id` INT NOT NULL,
`token` VARCHAR(256) UNIQUE NOT NULL,
`reference_1` LONGTEXT DEFAULT NULL,
`reference_2` LONGTEXT DEFAULT NULL,
`reference_3` LONGTEXT DEFAULT NULL,
`reference_4` LONGTEXT DEFAULT NULL,
`reference_5` LONGTEXT DEFAULT NULL,
`reference_6` LONGTEXT DEFAULT NULL,
`created_timestamp` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
`expired_interval` INT DEFAULT NULL,
PRIMARY KEY (id)
)
ENGINE = INNODB;
# uri api
INSERT IGNORE INTO `hot`.`uri` (`representation`,
`content`,
`virtual_address`,
`physical_address`,
`authorized_id`,
`scopes`,
`type`)
VALUES ('^((\\/){1,}hot(\\/){1,}public(\\/){1,}api(.php){0,1}(\\/){1,}(board|user|device|server){1}(\\/){1,}activate(\\/)*)',
'Src\\Controller\\Activation\\ActivationController',
NULL,
NULL,
NULL,
'0,0,0,0',
'api');
INSERT IGNORE INTO `hot`.`uri` (`representation`,
`content`,
`virtual_address`,
`physical_address`,
`authorized_id`,
`scopes`,
`type`)
VALUES ('^((\\/){1,}hot(\\/){1,}public(\\/){1,}api(.php){0,1}(\\/){1,}(board|user|device|server){1}(\\/){1,}authorize(\\/)*)',
'Src\\Controller\\Authorization\\AuthorizationController',
NULL,
NULL,
NULL,
'0,0,0,0',
'api');
INSERT IGNORE INTO `hot`.`uri` (`representation`,
`content`,
`virtual_address`,
`physical_address`,
`authorized_id`,
`scopes`,
`type`)
VALUES ('^((\\/){1,}hot(\\/){1,}public(\\/){1,}api(.php){0,1}(\\/){1,}(board|user|device|server){1}(\\/){1,}checking(\\/)*)',
'Src\\Controller\\Configuration\\CheckingController',
NULL,
NULL,
NULL,
'1,0,0,0|0,1,0,0|0,0,1,0|0,0,0,1',
'api');
INSERT IGNORE INTO `hot`.`uri` (`representation`,
`content`,
`virtual_address`,
`physical_address`,
`authorized_id`,
`scopes`,
`type`)
VALUES ('^((\\/){1,}hot(\\/){1,}public(\\/){1,}api(.php){0,1}(\\/){1,}(board|user|device|server){1}(\\/){1,}configuration(\\/)*)',
'Src\\Controller\\Configuration\\ConfigurationController',
NULL,
NULL,
NULL,
'1,0,0,0|0,1,0,0|0,0,1,0|0,0,0,1',
'api');
INSERT IGNORE INTO `hot`.`uri` (`representation`,
`content`,
`virtual_address`,
`physical_address`,
`authorized_id`,
`scopes`,
`type`)
VALUES ('^((\\/){1,}hot(\\/){1,}public(\\/){1,}api(.php){0,1}(\\/){1,}(board|user|device|server){1}(\\/){1,}profile(\\/)*)',
'Src\\Controller\\Detail\\DetailController',
NULL,
NULL,
NULL,
'1,0,0,0|0,1,0,0|0,0,1,0|0,0,0,1',
'api');