--
-- Host: localhost    Database: weerstationdb
-- ------------------------------------------------------


--
-- Table structure for table `meting`
--

CREATE TABLE `meting` (
  `metingId` int(11) NOT NULL AUTO_INCREMENT,
  `tijdstip` datetime DEFAULT NULL,
  `waarde` decimal(10,0) DEFAULT NULL,
  `sensorId` int(11) NOT NULL,
  PRIMARY KEY (`metingId`),
  KEY `metingFk_idx` (`sensorId`),
  CONSTRAINT `metingFk` FOREIGN KEY (`sensorId`) REFERENCES `sensor` (`sensorId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `meting`
--

INSERT INTO `meting` VALUES (14,'2017-06-18 17:08:04',20,1),(15,'2017-06-18 17:08:07',20,1),(16,'2017-06-18 17:08:11',21,1),(17,'2017-06-18 17:08:13',22,1),(18,'2017-06-18 17:08:17',23,1),(24,'2017-06-18 17:09:47',45,2),(25,'2017-06-18 17:09:50',45,2),(26,'2017-06-18 17:09:53',50,2),(27,'2017-06-18 17:09:58',55,2),(28,'2017-06-18 17:10:35',55,2);

--
-- Table structure for table `sensor`
--

CREATE TABLE `sensor` (
  `sensorId` int(11) NOT NULL AUTO_INCREMENT,
  `naam` varchar(45) DEFAULT NULL,
  `eenheid` varchar(45) DEFAULT NULL,
  `type` varchar(45) DEFAULT NULL,
  `weerstationId` int(11) DEFAULT NULL,
  PRIMARY KEY (`sensorId`),
  KEY `weerstationFk_idx` (`weerstationId`),
  CONSTRAINT `sensorFk` FOREIGN KEY (`weerstationId`) REFERENCES `weerstation` (`weerstationId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `sensor`
--

INSERT INTO `sensor` VALUES (1,'dht21','procent %','vochtigheid',1),(2,'dht21','C','warmte',1);

--
-- Table structure for table `weerstation`
--

CREATE TABLE `weerstation` (
  `weerstationId` int(11) NOT NULL AUTO_INCREMENT,
  `locatie` varchar(45) DEFAULT NULL,
  `naam` varchar(45) DEFAULT NULL,
  `gebruikerId` int(11) DEFAULT NULL,
  PRIMARY KEY (`weerstationId`),
  KEY `gebruikerFk_idx` (`gebruikerId`),
  CONSTRAINT `gebruikerFk` FOREIGN KEY (`gebruikerId`) REFERENCES `gebruiker` (`gebriukerId`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

--
-- Dumping data for table `weerstation`
--

INSERT INTO `weerstation` VALUES (1,'belgie','weer1',1),(2,'belgie','weer2',NULL),(3,'belgie','weer3',NULL);

--
-- Dumping events for database 'weerstationdb'
--

--
-- Dumping routines for database 'weerstationdb'
--


