-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.sql
64 lines (61 loc) · 2.7 KB
/
schema.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
/*!40101 SET NAMES utf8 */;
/*!40101 SET SQL_MODE=''*/;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
CREATE DATABASE /*!32312 IF NOT EXISTS*/`rinhonode` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `rinhonode`;
DROP TABLE IF EXISTS `actions`;
CREATE TABLE `actions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`deviceId` varchar(20) NOT NULL,
`reference` varchar(50) DEFAULT NULL,
`cmd` varchar(200) DEFAULT NULL,
`response` varchar(200) DEFAULT NULL,
`status` tinyint(4) DEFAULT '0',
`createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`modifiedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `status` (`status`),
KEY `idequipo` (`deviceId`,`status`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
DROP TABLE IF EXISTS `tracks`;
CREATE TABLE `tracks` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`deviceId` varchar(20) CHARACTER SET utf8 NOT NULL DEFAULT '',
`reportType` varchar(2) DEFAULT NULL,
`reportId` varchar(2) CHARACTER SET utf8 DEFAULT NULL,
`gpsDateTime` datetime DEFAULT NULL,
`reportDateTime` datetime DEFAULT NULL,
`latitude` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`longitude` varchar(50) CHARACTER SET utf8 DEFAULT NULL,
`speed` decimal(5,2) DEFAULT NULL,
`course` decimal(5,2) DEFAULT NULL,
`altitude` decimal(5,2) DEFAULT NULL,
`ign` tinyint(1) DEFAULT NULL,
`inputs` varchar(10) CHARACTER SET utf8 DEFAULT NULL,
`outputs` varchar(10) CHARACTER SET utf8 DEFAULT NULL,
`voltageMainPower` decimal(5,2) DEFAULT NULL,
`odometer` int(11) DEFAULT NULL,
`gpsPower` tinyint(1) DEFAULT NULL,
`gpsFixMode` int(11) DEFAULT NULL,
`gpsPdop` int(11) DEFAULT NULL,
`gpsQtySat` int(11) DEFAULT NULL,
`gpsAge` int(11) DEFAULT NULL,
`gsmPower` tinyint(1) DEFAULT NULL,
`gsmStatus` varchar(1) DEFAULT NULL,
`gsmLevel` int(11) DEFAULT NULL,
`txtMessage` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
`msgNum` varchar(5) CHARACTER SET utf8 DEFAULT NULL,
`sourcePacket` varchar(200) DEFAULT NULL,
`createdAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`modifiedAt` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
KEY `deviceIdRangeReportDateTime` (`deviceId`,`reportDateTime`),
KEY `deviceIdRangeCreated` (`deviceId`,`createdAt`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;