forked from kolaCZek/evDash_serverapi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb.sql
46 lines (45 loc) · 1.55 KB
/
db.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
CREATE TABLE `users` (
`iduser` int(11) NOT NULL AUTO_INCREMENT,
`apikey` varchar(12) NOT NULL,
`IP` varchar(16) DEFAULT NULL,
`timezone` varchar(64) DEFAULT 'UTC',
`notifications` TINYINT(4) DEFAULT 0,
`abrp_enabled` TINYINT(4) DEFAULT 0,
`abrp_token` varchar(45) DEFAULT NULL,
PRIMARY KEY (`iduser`),
KEY `apikey` (`apikey`)
);
CREATE TABLE `data` (
`iddata` int(11) NOT NULL AUTO_INCREMENT,
`user` int(11) NOT NULL,
`timestamp` datetime NOT NULL DEFAULT current_timestamp(),
`IP` varchar(16) DEFAULT NULL,
`carType` int(11) DEFAULT NULL,
`ignitionOn` TINYINT(4) DEFAULT NULL,
`chargingOn` TINYINT(4) DEFAULT NULL,
`socPerc` float DEFAULT NULL,
`socPercBms` float DEFAULT NULL,
`sohPerc` float DEFAULT NULL,
`batPowerKw` float DEFAULT NULL,
`batPowerAmp` float DEFAULT NULL,
`batVoltage` float DEFAULT NULL,
`auxVoltage` float DEFAULT NULL,
`auxAmp` float DEFAULT NULL,
`batMinC` float DEFAULT NULL,
`batMaxC` float DEFAULT NULL,
`batInletC` float DEFAULT NULL,
`extTemp` float DEFAULT NULL,
`batFanStatus` float DEFAULT NULL,
`speedKmh` float DEFAULT NULL,
`odoKm` float DEFAULT NULL,
`cumulativeEnergyChargedKWh` float DEFAULT NULL,
`cumulativeEnergyDischargedKWh` float DEFAULT NULL,
`gpsLat` float DEFAULT NULL,
`gpsLon` float DEFAULT NULL,
`gpsAlt` float DEFAULT NULL,
`gpsSpeed` float DEFAULT NULL,
PRIMARY KEY (`iddata`),
KEY `timestamp` (`timestamp`),
KEY `userid_fk_idx` (`user`),
CONSTRAINT `userid_fk` FOREIGN KEY (`user`) REFERENCES `users` (`iduser`) ON DELETE NO ACTION ON UPDATE NO ACTION
);