-- MySQL dump 10.13  Distrib 5.7.12, for Win64 (x86_64)
--
-- Host: localhost    Database: unlockit-instructables
-- ------------------------------------------------------
-- Server version	5.7.17-log

/*!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 utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!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 */;

--
-- Table structure for table `access`
--

DROP TABLE IF EXISTS `access`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `access` (
  `IDAccess` int(11) NOT NULL AUTO_INCREMENT,
  `Openned` tinyint(1) DEFAULT NULL,
  `DATE` date DEFAULT NULL,
  `TIME` time DEFAULT NULL,
  `system_IDSystem` int(11) NOT NULL,
  `categories_IDCategory` int(11) NOT NULL,
  PRIMARY KEY (`IDAccess`,`system_IDSystem`,`categories_IDCategory`),
  KEY `fk_access_system1_idx` (`system_IDSystem`),
  KEY `fk_access_categories1_idx` (`categories_IDCategory`),
  CONSTRAINT `fk_access_categories1` FOREIGN KEY (`categories_IDCategory`) REFERENCES `categories` (`IDCategory`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_access_system1` FOREIGN KEY (`system_IDSystem`) REFERENCES `system` (`IDSystem`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `categories`
--

DROP TABLE IF EXISTS `categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `categories` (
  `IDCategory` int(11) NOT NULL AUTO_INCREMENT,
  `Category` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`IDCategory`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `contact`
--

DROP TABLE IF EXISTS `contact`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `contact` (
  `IDcontact` int(11) NOT NULL AUTO_INCREMENT,
  `fullname` varchar(50) DEFAULT NULL,
  `telephone` varchar(15) DEFAULT NULL,
  `mail` varchar(45) DEFAULT NULL,
  `message` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`IDcontact`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `motion`
--

DROP TABLE IF EXISTS `motion`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `motion` (
  `IDMotion` int(11) NOT NULL AUTO_INCREMENT,
  `Date` date DEFAULT NULL,
  `Time` time DEFAULT NULL,
  `system_IDSystem` int(11) NOT NULL,
  PRIMARY KEY (`IDMotion`,`system_IDSystem`),
  KEY `fk_motion_system1_idx` (`system_IDSystem`),
  CONSTRAINT `fk_motion_system1` FOREIGN KEY (`system_IDSystem`) REFERENCES `system` (`IDSystem`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `rfid`
--

DROP TABLE IF EXISTS `rfid`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `rfid` (
  `IDRFID` int(11) NOT NULL AUTO_INCREMENT,
  `RFIDNo` varchar(45) DEFAULT NULL,
  `users_IDUser` int(11) NOT NULL,
  PRIMARY KEY (`IDRFID`,`users_IDUser`),
  UNIQUE KEY `RFIDNo_UNIQUE` (`RFIDNo`),
  KEY `fk_rfid_users_idx` (`users_IDUser`),
  CONSTRAINT `fk_rfid_users` FOREIGN KEY (`users_IDUser`) REFERENCES `users` (`IDUser`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `status`
--

DROP TABLE IF EXISTS `status`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `status` (
  `IDStatus` int(11) NOT NULL AUTO_INCREMENT,
  `Description` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`IDStatus`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `system`
--

DROP TABLE IF EXISTS `system`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `system` (
  `IDSystem` int(11) NOT NULL AUTO_INCREMENT,
  `SerialNo` varchar(45) DEFAULT NULL,
  `Name` varchar(45) DEFAULT NULL,
  `StateUse` tinyint(1) DEFAULT NULL,
  `status_IDStatus` int(11) NOT NULL,
  PRIMARY KEY (`IDSystem`,`status_IDStatus`),
  UNIQUE KEY `SerialNo_UNIQUE` (`SerialNo`),
  KEY `fk_system_status1_idx` (`status_IDStatus`),
  CONSTRAINT `fk_system_status1` FOREIGN KEY (`status_IDStatus`) REFERENCES `status` (`IDStatus`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `system_has_rfid`
--

DROP TABLE IF EXISTS `system_has_rfid`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `system_has_rfid` (
  `system_IDSystem` int(11) NOT NULL,
  `rfid_IDRFID` int(11) NOT NULL,
  `rfid_users_IDUser` int(11) NOT NULL,
  PRIMARY KEY (`system_IDSystem`,`rfid_IDRFID`,`rfid_users_IDUser`),
  KEY `fk_system_has_rfid_rfid1_idx` (`rfid_IDRFID`,`rfid_users_IDUser`),
  KEY `fk_system_has_rfid_system1_idx` (`system_IDSystem`),
  CONSTRAINT `fk_system_has_rfid_rfid1` FOREIGN KEY (`rfid_IDRFID`, `rfid_users_IDUser`) REFERENCES `rfid` (`IDRFID`, `users_IDUser`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_system_has_rfid_system1` FOREIGN KEY (`system_IDSystem`) REFERENCES `system` (`IDSystem`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `users` (
  `IDUser` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(45) DEFAULT NULL,
  `FirstName` varchar(45) DEFAULT NULL,
  `Email` varchar(45) DEFAULT NULL,
  `Password` varchar(200) DEFAULT NULL,
  `Adress` varchar(45) DEFAULT NULL,
  `City` varchar(45) DEFAULT NULL,
  `PostalCode` varchar(45) DEFAULT NULL,
  `Country` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`IDUser`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping routines for database 'unlockit-instructables'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2017-06-18 23:52:31
