This repository has been archived by the owner on Feb 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trailsendmonitor.sql
95 lines (77 loc) · 2.69 KB
/
trailsendmonitor.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
-- phpMyAdmin SQL Dump
-- version 4.6.6deb4
-- https://www.phpmyadmin.net/
--
-- Host: localhost:3306
-- Generation Time: Apr 02, 2018 at 12:33 AM
-- Server version: 10.1.23-MariaDB-9+deb9u1
-- PHP Version: 7.0.27-0+deb9u1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Database: `trailsendmonitor`
--
CREATE DATABASE IF NOT EXISTS `trailsendmonitor` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
USE `trailsendmonitor`;
-- --------------------------------------------------------
--
-- Table structure for table `data`
--
DROP TABLE IF EXISTS `data`;
CREATE TABLE IF NOT EXISTS `data` (
`id` int(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`stream-id` int(11) NOT NULL,
`timestamp` datetime NOT NULL,
`value` float NOT NULL,
PRIMARY KEY (`id`),
KEY `stream-id` (`stream-id`),
KEY `timestamp` (`timestamp`)
) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `relations`
--
DROP TABLE IF EXISTS `relations`;
CREATE TABLE IF NOT EXISTS `relations` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`info` text,
`disabled` tinyint(1) NOT NULL DEFAULT '1',
`dashboard` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Table structure for table `streams`
--
DROP TABLE IF EXISTS `streams`;
CREATE TABLE IF NOT EXISTS `streams` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL,
`description` varchar(256) DEFAULT NULL,
`device-serial` varchar(50) DEFAULT NULL,
`unit` varchar(4) DEFAULT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
--
-- Dumping data for table `streams`
--
INSERT INTO `streams` (`id`, `name`, `description`, `device-serial`, `unit`, `disabled`) VALUES
(7, 'Test', 'A fake device to test with', 't1000', '0.00', 1),
(8, 'battery_sens', 'The sensor for the main DC Bus.', 'A5BAD', '0.1', 1);
--
-- Constraints for dumped tables
--
--
-- Constraints for table `data`
--
ALTER TABLE `data`
ADD CONSTRAINT `streams in data` FOREIGN KEY (`stream-id`) REFERENCES `streams` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;