
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


--
-- Database: `graphite`
--
CREATE DATABASE IF NOT EXISTS `graphite5` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
USE `graphite5`;

-- --------------------------------------------------------

--
-- Table structure for table `cron_runs`
--

CREATE TABLE `cron_runs` (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `tiCronType` tinyint UNSIGNED NOT NULL DEFAULT '0',
  `bManual` tinyint UNSIGNED NOT NULL DEFAULT '0',
  `intProcessID` int UNSIGNED NOT NULL DEFAULT '0',
  `bRunning` tinyint UNSIGNED NOT NULL DEFAULT '0',
  `fRunLength` float(13,3) UNSIGNED NOT NULL DEFAULT '0.000',
  `dtCreated` int UNSIGNED NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `dtCreaded` (`dtCreated`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `email_queue`
--

CREATE TABLE `email_queue` (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `bNotification` tinyint NOT NULL DEFAULT '0',
  `intSentByID` int UNSIGNED DEFAULT '0',
  `bSent` tinyint NOT NULL DEFAULT '0',
  `dtSent` int UNSIGNED DEFAULT '0',
  `vcSent` varchar(48) DEFAULT NULL,
  `vcTo` varchar(255) DEFAULT NULL,
  `vcCc` varchar(255) DEFAULT NULL,
  `vcBcc` varchar(255) DEFAULT NULL,
  `vcSubject` varchar(255) DEFAULT NULL,
  `txtBody` text,
  `txtAttachments` text,
  `vcError` varchar(255) DEFAULT NULL,
  `vcCreated` varchar(48) DEFAULT NULL,
  `dtCreated` int UNSIGNED DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `bSent` (`bSent`),      
  KEY `vcTo` (`vcTo`),        
  KEY `intSentByID` (`intSentByID`),    
  KEY `dtSent` (`dtSent`),
  KEY `dtCreaded` (`dtCreated`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `media`
--

CREATE TABLE `media` (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `vcUUID` varchar(36) DEFAULT NULL,
  `bActive` tinyint UNSIGNED NOT NULL DEFAULT '1',
  `bDeleted` tinyint NOT NULL DEFAULT '0',
  `vcFileName` varchar(255) DEFAULT NULL,
  `vcSrcPath` varchar(255) DEFAULT NULL,
  `vcThumbPath` varchar(255) DEFAULT NULL,
  `tiMediaType` tinyint UNSIGNED DEFAULT '0',
  `vcMimeType` varchar(255) DEFAULT NULL,
  `intFileSize` int DEFAULT '0',
  `intImageWidth` int DEFAULT '0',
  `intImageHeight` int DEFAULT '0',
  `dtCreated` int UNSIGNED DEFAULT '0',
  `dtLastModified` int UNSIGNED DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `vcUUID` (`vcUUID`),      
  KEY `bActive` (`bActive`),      
  KEY `tiMediaType` (`tiMediaType`),        
  KEY `dtCreated` (`dtCreated`),
  KEY `dtLastModified` (`dtLastModified`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

--
-- Table structure for table `metadata`
--

CREATE TABLE `metadata` (
  `id` int(11) UNSIGNED NOT NULL,
  `intMetaType` int NOT NULL,
  `intInitiatorID` int NOT NULL DEFAULT '0',
  `jsonDetails` json DEFAULT NULL,
  `dtCreated` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `intMetaType` (`intMetaType`),      
  KEY `intInitiatorID` (`intInitiatorID`),      
  KEY `dtCreated` (`dtCreated`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- --------------------------------------------------------

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

CREATE TABLE `users` (
  `id` int UNSIGNED NOT NULL AUTO_INCREMENT,
  `vcUUID` varchar(36) DEFAULT NULL,
  `flBitFlags` bigint UNSIGNED DEFAULT '0',
  `intUserRole` int UNSIGNED NOT NULL DEFAULT '0',
  `intCreatedByID` int UNSIGNED NOT NULL DEFAULT '0',
  `bActive` tinyint NOT NULL DEFAULT '1',
  `bSuperUser` tinyint NOT NULL DEFAULT '0',
  `bConfirmed` tinyint NOT NULL DEFAULT '0',
  `vcConfirmedCode` varchar(128) DEFAULT NULL,
  `vcRemoteAddr` varchar(64) DEFAULT NULL,
  `emlEmail` varchar(64) DEFAULT NULL,
  `vcPasPassword` varchar(255) DEFAULT NULL,
  `vcAuthHash` varchar(255) DEFAULT NULL,
  `vcFirstName` varchar(32) DEFAULT NULL,
  `vcLastName` varchar(32) DEFAULT NULL,
  `vcAddress1` varchar(64) DEFAULT NULL,
  `vcAddress2` varchar(64) DEFAULT NULL,
  `vcCity` varchar(64) DEFAULT NULL,
  `vcState` varchar(48) DEFAULT NULL,
  `vcPostalCode` varchar(24) DEFAULT NULL,
  `phPhone` varchar(24) DEFAULT NULL,
  `phFax` varchar(24) DEFAULT NULL,
  `dtCreated` int UNSIGNED DEFAULT '0',
  `dtExpireDate` int UNSIGNED DEFAULT '0',
  `dtLastLogin` int UNSIGNED DEFAULT '0',
  `dtLastModified` int UNSIGNED DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `vcUUID` (`vcUUID`),
  KEY `flBitFlags` (`flBitFlags`),      
  KEY `intUserRole` (`intUserRole`),      
  KEY `bActive` (`bActive`),    
  KEY `emlEmail` (`emlEmail`),    
  KEY `dtLastModified` (`dtLastModified`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
