text: -- MySQL dump 10.13  Distrib 5.6.30-76.3, for debian-linux-gnu (x86_64)
  --
  -- Host: localhost    Database: intranetdb
  -- ------------------------------------------------------
  -- Server version	5.6.30-76.3-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 `booking`
  --
  
  DROP TABLE IF EXISTS `booking`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `booking` (
    `booking_id` mediumint(5) NOT NULL AUTO_INCREMENT,
    `staff_id` mediumint(5) NOT NULL,
    `note` varchar(64) NOT NULL,
    `duration` varchar(64) NOT NULL,
    `start` datetime NOT NULL,
    `deleted` tinyint(1) NOT NULL DEFAULT '0',
    `machine_id` tinytext NOT NULL,
    PRIMARY KEY (`booking_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=355 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `booking_log`
  --
  
  DROP TABLE IF EXISTS `booking_log`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `booking_log` (
    `id` mediumint(5) NOT NULL AUTO_INCREMENT,
    `ip_address` varchar(15) CHARACTER SET latin1 NOT NULL,
    `booking_id` mediumint(5) NOT NULL,
    `operation` enum('add','delete') CHARACTER SET latin1 NOT NULL,
    `timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=6002 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `booking_machine_rel`
  --
  
  DROP TABLE IF EXISTS `booking_machine_rel`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `booking_machine_rel` (
    `id` mediumint(5) NOT NULL AUTO_INCREMENT,
    `booking_id` mediumint(5) NOT NULL,
    `machine_id` mediumint(5) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=249 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `ci_sessions`
  --
  
  DROP TABLE IF EXISTS `ci_sessions`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `ci_sessions` (
    `session_id` varchar(40) NOT NULL DEFAULT '0',
    `ip_address` varchar(16) NOT NULL DEFAULT '0',
    `user_agent` varchar(50) NOT NULL,
    `last_activity` int(10) unsigned NOT NULL DEFAULT '0',
    `user_data` text NOT NULL,
    PRIMARY KEY (`session_id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `departments`
  --
  
  DROP TABLE IF EXISTS `departments`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `departments` (
    `dept_id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(25) NOT NULL,
    `last_change` varchar(25) NOT NULL,
    PRIMARY KEY (`dept_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `doorcards`
  --
  
  DROP TABLE IF EXISTS `doorcards`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `doorcards` (
    `doorcard_id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(25) NOT NULL,
    `operational` tinyint(1) NOT NULL DEFAULT '1',
    `last_update` varchar(25) DEFAULT NULL,
    PRIMARY KEY (`doorcard_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=67 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `exchfilter`
  --
  
  DROP TABLE IF EXISTS `exchfilter`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `exchfilter` (
    `id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(60) NOT NULL COMMENT 'folder name',
    `parent` mediumint(5) unsigned DEFAULT NULL COMMENT 'parent folder id',
    `domain` varchar(60) NOT NULL COMMENT 'domain name',
    `email` varchar(60) NOT NULL COMMENT 'email address',
    `path` varchar(260) NOT NULL COMMENT 'folder path',
    `submit` varchar(25) NOT NULL,
    PRIMARY KEY (`id`),
    KEY `name` (`name`),
    KEY `domain` (`domain`)
  ) ENGINE=InnoDB AUTO_INCREMENT=567 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `extensions`
  --
  
  DROP TABLE IF EXISTS `extensions`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `extensions` (
    `extn_id` smallint(3) unsigned NOT NULL AUTO_INCREMENT,
    `name` smallint(3) unsigned NOT NULL,
    `desc` varchar(20) NOT NULL,
    `wall_port` smallint(6) NOT NULL,
    `last_update` varchar(25) NOT NULL,
    PRIMARY KEY (`extn_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `fg_types`
  --
  
  DROP TABLE IF EXISTS `fg_types`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `fg_types` (
    `id` mediumint(5) NOT NULL AUTO_INCREMENT,
    `description` varchar(10) NOT NULL,
    `sort_order` int(10) unsigned NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `holidays`
  --
  
  DROP TABLE IF EXISTS `holidays`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `holidays` (
    `id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(25) NOT NULL,
    `staff_id` mediumint(5) unsigned NOT NULL,
    `start` datetime NOT NULL,
    `end` datetime NOT NULL,
    `status` tinyint(1) unsigned NOT NULL,
    `approved` tinyint(1) unsigned NOT NULL,
    `submit` varchar(25) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `lu_holidays`
  --
  
  DROP TABLE IF EXISTS `lu_holidays`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `lu_holidays` (
    `id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(25) NOT NULL,
    `submit` varchar(25) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Lookup table for types of holidays';
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `machine`
  --
  
  DROP TABLE IF EXISTS `machine`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `machine` (
    `machine_id` mediumint(5) NOT NULL AUTO_INCREMENT,
    `deleted` tinyint(1) NOT NULL DEFAULT '0',
    `name` varchar(32) NOT NULL,
    `description` varchar(128) DEFAULT NULL,
    `os` varchar(32) DEFAULT NULL,
    `ram` varchar(32) DEFAULT NULL,
    `cpu` varchar(32) DEFAULT NULL,
    `diskspace` varchar(64) DEFAULT NULL,
    `rdp_sessions` smallint(2) NOT NULL,
    `powered` tinyint(1) NOT NULL DEFAULT '1',
    `type` set('laptop','desktop','server','vm','software','bds') DEFAULT NULL,
    `location` varchar(32) DEFAULT NULL,
    `comment` varchar(64) DEFAULT NULL,
    `last_backup` date NOT NULL,
    `periodicity` int(11) NOT NULL,
    `bookable` tinyint(1) NOT NULL DEFAULT '1',
    `last_update` varchar(32) DEFAULT '0',
    PRIMARY KEY (`machine_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=90 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `services`
  --
  
  DROP TABLE IF EXISTS `services`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `services` (
    `id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(45) NOT NULL,
    `description` varchar(60) NOT NULL,
    `machine` varchar(15) NOT NULL,
    `linux` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Is the server running Linux?',
    `submit` varchar(25) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `software`
  --
  
  DROP TABLE IF EXISTS `software`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `software` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `machine_id` int(11) NOT NULL,
    `name` varchar(255) NOT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `staff`
  --
  
  DROP TABLE IF EXISTS `staff`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `staff` (
    `staff_id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(60) NOT NULL,
    `firstname` varchar(20) NOT NULL,
    `midname` varchar(20) NOT NULL,
    `surname` varchar(20) NOT NULL,
    `extn_id` mediumint(5) NOT NULL,
    `dept_id` mediumint(5) NOT NULL,
    `start_date` date NOT NULL,
    `end_date` date NOT NULL,
    `active` tinyint(1) NOT NULL DEFAULT '0',
    `display_midname` tinyint(1) NOT NULL,
    `days_per_week` tinyint(1) unsigned NOT NULL DEFAULT '5',
    `doorcard_id` mediumint(5) unsigned NOT NULL,
    `work_state` enum('Working','Not Working','Vacation','Sick','NaN') NOT NULL DEFAULT 'Working',
    `xmpp` varchar(40) NOT NULL,
    `last_update` varchar(25) NOT NULL,
    PRIMARY KEY (`staff_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=108 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
  /*!40101 SET character_set_client = @saved_cs_client */;
  ALTER DATABASE `intranetdb` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
  /*!50003 SET @saved_cs_client      = @@character_set_client */ ;
  /*!50003 SET @saved_cs_results     = @@character_set_results */ ;
  /*!50003 SET @saved_col_connection = @@collation_connection */ ;
  /*!50003 SET character_set_client  = utf8 */ ;
  /*!50003 SET character_set_results = utf8 */ ;
  /*!50003 SET collation_connection  = utf8_general_ci */ ;
  /*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
  /*!50003 SET sql_mode              = 'NO_AUTO_VALUE_ON_ZERO' */ ;
  DELIMITER ;;
  /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `staff_insert` BEFORE INSERT ON `staff`
   FOR EACH ROW BEGIN
  IF NEW.display_midname=1 THEN SET NEW.name=CONCAT_WS(' ',NEW.firstname,NEW.midname,NEW.surname);
  ELSE SET NEW.name=CONCAT_WS(' ',NEW.firstname,NEW.surname);
  END IF;
  END */;;
  DELIMITER ;
  /*!50003 SET sql_mode              = @saved_sql_mode */ ;
  /*!50003 SET character_set_client  = @saved_cs_client */ ;
  /*!50003 SET character_set_results = @saved_cs_results */ ;
  /*!50003 SET collation_connection  = @saved_col_connection */ ;
  ALTER DATABASE `intranetdb` CHARACTER SET utf8 COLLATE utf8_general_ci ;
  ALTER DATABASE `intranetdb` CHARACTER SET latin1 COLLATE latin1_swedish_ci ;
  /*!50003 SET @saved_cs_client      = @@character_set_client */ ;
  /*!50003 SET @saved_cs_results     = @@character_set_results */ ;
  /*!50003 SET @saved_col_connection = @@collation_connection */ ;
  /*!50003 SET character_set_client  = utf8 */ ;
  /*!50003 SET character_set_results = utf8 */ ;
  /*!50003 SET collation_connection  = utf8_general_ci */ ;
  /*!50003 SET @saved_sql_mode       = @@sql_mode */ ;
  /*!50003 SET sql_mode              = 'NO_AUTO_VALUE_ON_ZERO' */ ;
  DELIMITER ;;
  /*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `staff_update` BEFORE UPDATE ON `staff`
   FOR EACH ROW BEGIN
  IF NEW.display_midname=1 THEN SET NEW.name=CONCAT_WS(' ',NEW.firstname,NEW.midname,NEW.surname);
  ELSE SET NEW.name=CONCAT_WS(' ',NEW.firstname,NEW.surname);
  END IF;
  END */;;
  DELIMITER ;
  /*!50003 SET sql_mode              = @saved_sql_mode */ ;
  /*!50003 SET character_set_client  = @saved_cs_client */ ;
  /*!50003 SET character_set_results = @saved_cs_results */ ;
  /*!50003 SET collation_connection  = @saved_col_connection */ ;
  ALTER DATABASE `intranetdb` CHARACTER SET utf8 COLLATE utf8_general_ci ;
  
  --
  -- Table structure for table `tbl_backups`
  --
  
  DROP TABLE IF EXISTS `tbl_backups`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `tbl_backups` (
    `id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `notification_date` date NOT NULL,
    `notified` tinyint(1) NOT NULL DEFAULT '0',
    PRIMARY KEY (`id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `telephones`
  --
  
  DROP TABLE IF EXISTS `telephones`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `telephones` (
    `telephone_id` mediumint(5) unsigned NOT NULL AUTO_INCREMENT,
    `name` varchar(20) NOT NULL,
    `description` varchar(20) NOT NULL,
    `staff_id` mediumint(5) unsigned NOT NULL,
    `display` tinyint(1) NOT NULL DEFAULT '1',
    `last_update` varchar(25) NOT NULL,
    PRIMARY KEY (`telephone_id`)
  ) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
  /*!40101 SET character_set_client = @saved_cs_client */;
  
  --
  -- Table structure for table `wol`
  --
  
  DROP TABLE IF EXISTS `wol`;
  /*!40101 SET @saved_cs_client     = @@character_set_client */;
  /*!40101 SET character_set_client = utf8 */;
  CREATE TABLE `wol` (
    `id` mediumint(3) NOT NULL AUTO_INCREMENT,
    `name` varchar(17) NOT NULL,
    `desc` varchar(20) NOT NULL,
    `user` varchar(30) NOT NULL,
    `submit` varchar(25) NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE KEY `desc` (`desc`),
    KEY `user` (`user`)
  ) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
  /*!40101 SET character_set_client = @saved_cs_client */;
  /*!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 2016-07-14 14:55:34
  