1 -- MySQL dump 10.13 Distrib 5.5.35, for debian-linux-gnu (i686)
3 -- Host: estia Database: meteo
4 -- ------------------------------------------------------
5 -- Server version 5.5.35-0ubuntu0.13.10.2
7 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
8 /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
9 /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
10 /*!40101 SET NAMES utf8 */;
11 /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
12 /*!40103 SET TIME_ZONE='+00:00' */;
13 /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
14 /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
15 /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
16 /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19 -- Table structure for table `sensor_types`
22 DROP TABLE IF EXISTS `sensor_types`;
23 /*!40101 SET @saved_cs_client = @@character_set_client */;
24 /*!40101 SET character_set_client = utf8 */;
25 CREATE TABLE `sensor_types` (
26 `id` int(11) NOT NULL AUTO_INCREMENT,
27 `st_name` varchar(32) CHARACTER SET utf8 NOT NULL,
28 `st_description` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
30 UNIQUE KEY `st_name` (`st_name`)
31 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
32 /*!40101 SET character_set_client = @saved_cs_client */;
35 -- Table structure for table `sensor_values`
38 DROP TABLE IF EXISTS `sensor_values`;
39 /*!40101 SET @saved_cs_client = @@character_set_client */;
40 /*!40101 SET character_set_client = utf8 */;
41 CREATE TABLE `sensor_values` (
42 `id` int(11) NOT NULL AUTO_INCREMENT,
43 `sensor_id` int(11) NOT NULL,
44 `timestamp` datetime NOT NULL,
45 `value` float NOT NULL,
46 `parameter_id` int(11) NOT NULL,
48 KEY `fk_sensor_values_sens_idx` (`sensor_id`),
49 KEY `sensor_values_idx` (`sensor_id`,`timestamp`),
50 KEY `fk_sensor_values_param_idx` (`parameter_id`),
51 CONSTRAINT `fk_sensor_values_param` FOREIGN KEY (`parameter_id`) REFERENCES `st_parameters` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
52 CONSTRAINT `fk_sensor_values_sens` FOREIGN KEY (`sensor_id`) REFERENCES `sensors` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
53 ) ENGINE=InnoDB AUTO_INCREMENT=223855 DEFAULT CHARSET=utf8;
54 /*!40101 SET character_set_client = @saved_cs_client */;
57 -- Table structure for table `sensors`
60 DROP TABLE IF EXISTS `sensors`;
61 /*!40101 SET @saved_cs_client = @@character_set_client */;
62 /*!40101 SET character_set_client = utf8 */;
63 CREATE TABLE `sensors` (
64 `id` int(11) NOT NULL AUTO_INCREMENT,
65 `st_id` int(11) NOT NULL,
66 `s_id` varchar(32) CHARACTER SET utf8 NOT NULL,
67 `s_description` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
69 UNIQUE KEY `UNIQUE` (`st_id`,`s_id`),
70 KEY `fk_sensors_st_idx` (`st_id`),
71 CONSTRAINT `fk_sensors_st` FOREIGN KEY (`st_id`) REFERENCES `sensor_types` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
72 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
73 /*!40101 SET character_set_client = @saved_cs_client */;
76 -- Table structure for table `st_parameters`
79 DROP TABLE IF EXISTS `st_parameters`;
80 /*!40101 SET @saved_cs_client = @@character_set_client */;
81 /*!40101 SET character_set_client = utf8 */;
82 CREATE TABLE `st_parameters` (
83 `id` int(11) NOT NULL AUTO_INCREMENT,
84 `st_id` int(11) NOT NULL,
85 `st_name` varchar(32) CHARACTER SET utf8 NOT NULL,
86 `st_unit` int(11) NOT NULL,
87 `st_description` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
88 `st_dot_color` varchar(45) DEFAULT 'red',
89 `st_fill_color_top` varchar(45) DEFAULT 'red',
90 `st_fill_color_bottom` varchar(45) DEFAULT 'blue',
91 `st_line_color` varchar(45) DEFAULT 'navy',
93 UNIQUE KEY `unique` (`st_id`,`st_name`),
94 KEY `fk_st_parameters_st_idx` (`st_id`),
95 KEY `fk_st_parameters_units_idx` (`st_unit`),
96 CONSTRAINT `fk_st_parameters_st` FOREIGN KEY (`st_id`) REFERENCES `sensor_types` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
97 CONSTRAINT `fk_st_parameters_units` FOREIGN KEY (`st_unit`) REFERENCES `units` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
98 ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
99 /*!40101 SET character_set_client = @saved_cs_client */;
102 -- Table structure for table `unit_conv`
105 DROP TABLE IF EXISTS `unit_conv`;
106 /*!40101 SET @saved_cs_client = @@character_set_client */;
107 /*!40101 SET character_set_client = utf8 */;
108 CREATE TABLE `unit_conv` (
109 `id` int(11) NOT NULL AUTO_INCREMENT,
110 `from_unit` int(11) NOT NULL,
111 `to_unit` int(11) NOT NULL,
116 ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
117 /*!40101 SET character_set_client = @saved_cs_client */;
120 -- Table structure for table `unit_groups`
123 DROP TABLE IF EXISTS `unit_groups`;
124 /*!40101 SET @saved_cs_client = @@character_set_client */;
125 /*!40101 SET character_set_client = utf8 */;
126 CREATE TABLE `unit_groups` (
127 `id` int(11) NOT NULL AUTO_INCREMENT,
128 `name` varchar(45) NOT NULL,
130 ) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
131 /*!40101 SET character_set_client = @saved_cs_client */;
134 -- Table structure for table `units`
137 DROP TABLE IF EXISTS `units`;
138 /*!40101 SET @saved_cs_client = @@character_set_client */;
139 /*!40101 SET character_set_client = utf8 */;
140 CREATE TABLE `units` (
141 `id` int(11) NOT NULL AUTO_INCREMENT,
142 `name` varchar(32) CHARACTER SET utf8 NOT NULL,
143 `name_short` varchar(8) CHARACTER SET utf8 NOT NULL,
144 `unit_group` int(11) NOT NULL,
146 KEY `fk_units_group_idx` (`unit_group`),
147 CONSTRAINT `fk_units_group` FOREIGN KEY (`unit_group`) REFERENCES `unit_groups` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
148 ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=latin1;
149 /*!40101 SET character_set_client = @saved_cs_client */;
150 /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
152 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
153 /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
154 /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
155 /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
156 /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
157 /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
158 /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
160 -- Dump completed on 2014-03-17 20:17:36