-- MySQL dump 10.13  Distrib 5.6.51, for Linux (x86_64)
--
-- Host: localhost    Database: shopdb_flask
-- ------------------------------------------------------
-- Server version	5.6.51

/*!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 `applications`
--

DROP TABLE IF EXISTS `applications`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `applications` (
  `appid` int(11) NOT NULL AUTO_INCREMENT,
  `appname` varchar(100) NOT NULL,
  `appdescription` varchar(255) DEFAULT NULL,
  `supportteamid` int(11) DEFAULT NULL,
  `isinstallable` tinyint(1) DEFAULT NULL,
  `applicationnotes` text,
  `installpath` varchar(255) DEFAULT NULL,
  `applicationlink` varchar(512) DEFAULT NULL,
  `documentationpath` varchar(512) DEFAULT NULL,
  `ishidden` tinyint(1) DEFAULT NULL,
  `isprinter` tinyint(1) DEFAULT NULL,
  `islicenced` tinyint(1) DEFAULT NULL,
  `image` varchar(255) DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`appid`),
  UNIQUE KEY `appname` (`appname`),
  KEY `supportteamid` (`supportteamid`),
  CONSTRAINT `applications_ibfk_1` FOREIGN KEY (`supportteamid`) REFERENCES `supportteams` (`supportteamid`)
) ENGINE=InnoDB AUTO_INCREMENT=82 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `appowners`
--

DROP TABLE IF EXISTS `appowners`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `appowners` (
  `appownerid` int(11) NOT NULL AUTO_INCREMENT,
  `appowner` varchar(100) NOT NULL,
  `sso` varchar(50) DEFAULT NULL,
  `email` varchar(100) DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`appownerid`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `appversions`
--

DROP TABLE IF EXISTS `appversions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `appversions` (
  `appversionid` int(11) NOT NULL AUTO_INCREMENT,
  `appid` int(11) NOT NULL,
  `version` varchar(50) NOT NULL,
  `releasedate` date DEFAULT NULL,
  `notes` varchar(255) DEFAULT NULL,
  `dateadded` datetime DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`appversionid`),
  UNIQUE KEY `uq_app_version` (`appid`,`version`),
  CONSTRAINT `appversions_ibfk_1` FOREIGN KEY (`appid`) REFERENCES `applications` (`appid`)
) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `businessunits`
--

DROP TABLE IF EXISTS `businessunits`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `businessunits` (
  `businessunitid` int(11) NOT NULL AUTO_INCREMENT,
  `businessunit` varchar(100) NOT NULL,
  `code` varchar(20) DEFAULT NULL COMMENT 'Short code',
  `description` text,
  `parentid` int(11) DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`businessunitid`),
  UNIQUE KEY `businessunit` (`businessunit`),
  UNIQUE KEY `code` (`code`),
  KEY `parentid` (`parentid`),
  CONSTRAINT `businessunits_ibfk_1` FOREIGN KEY (`parentid`) REFERENCES `businessunits` (`businessunitid`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `communications`
--

DROP TABLE IF EXISTS `communications`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `communications` (
  `communicationid` int(11) NOT NULL AUTO_INCREMENT,
  `machineid` int(11) NOT NULL,
  `comtypeid` int(11) NOT NULL,
  `ipaddress` varchar(50) DEFAULT NULL,
  `subnetmask` varchar(50) DEFAULT NULL,
  `gateway` varchar(50) DEFAULT NULL,
  `dns1` varchar(50) DEFAULT NULL,
  `dns2` varchar(50) DEFAULT NULL,
  `macaddress` varchar(50) DEFAULT NULL,
  `isdhcp` tinyint(1) DEFAULT NULL,
  `comport` varchar(20) DEFAULT NULL,
  `baudrate` int(11) DEFAULT NULL,
  `databits` int(11) DEFAULT NULL,
  `stopbits` varchar(10) DEFAULT NULL,
  `parity` varchar(20) DEFAULT NULL,
  `flowcontrol` varchar(20) DEFAULT NULL,
  `port` int(11) DEFAULT NULL,
  `username` varchar(100) DEFAULT NULL,
  `pathname` varchar(255) DEFAULT NULL,
  `pathname2` varchar(255) DEFAULT NULL COMMENT 'Secondary path for dualpath',
  `isprimary` tinyint(1) DEFAULT NULL COMMENT 'Primary communication method',
  `ismachinenetwork` tinyint(1) DEFAULT NULL COMMENT 'On machine network vs office network',
  `notes` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`communicationid`),
  KEY `comtypeid` (`comtypeid`),
  KEY `idx_comm_ip` (`ipaddress`),
  KEY `idx_comm_machine` (`machineid`),
  CONSTRAINT `communications_ibfk_1` FOREIGN KEY (`machineid`) REFERENCES `machines` (`machineid`),
  CONSTRAINT `communications_ibfk_2` FOREIGN KEY (`comtypeid`) REFERENCES `communicationtypes` (`comtypeid`)
) ENGINE=InnoDB AUTO_INCREMENT=117 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `communicationtypes`
--

DROP TABLE IF EXISTS `communicationtypes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `communicationtypes` (
  `comtypeid` int(11) NOT NULL AUTO_INCREMENT,
  `comtype` varchar(50) NOT NULL,
  `description` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`comtypeid`),
  UNIQUE KEY `comtype` (`comtype`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `installedapps`
--

DROP TABLE IF EXISTS `installedapps`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `installedapps` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `machineid` int(11) NOT NULL,
  `appid` int(11) NOT NULL,
  `appversionid` int(11) DEFAULT NULL,
  `isactive` tinyint(1) NOT NULL,
  `installeddate` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uq_machine_app` (`machineid`,`appid`),
  KEY `appid` (`appid`),
  KEY `appversionid` (`appversionid`),
  CONSTRAINT `installedapps_ibfk_1` FOREIGN KEY (`machineid`) REFERENCES `machines` (`machineid`),
  CONSTRAINT `installedapps_ibfk_2` FOREIGN KEY (`appid`) REFERENCES `applications` (`appid`),
  CONSTRAINT `installedapps_ibfk_3` FOREIGN KEY (`appversionid`) REFERENCES `appversions` (`appversionid`)
) ENGINE=InnoDB AUTO_INCREMENT=2392 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `knowledgebase`
--

DROP TABLE IF EXISTS `knowledgebase`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `knowledgebase` (
  `linkid` int(11) NOT NULL AUTO_INCREMENT,
  `appid` int(11) DEFAULT NULL,
  `shortdescription` varchar(500) NOT NULL,
  `linkurl` varchar(2000) DEFAULT NULL,
  `keywords` varchar(500) DEFAULT NULL,
  `clicks` int(11) DEFAULT NULL,
  `lastupdated` datetime DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`linkid`),
  KEY `appid` (`appid`),
  CONSTRAINT `knowledgebase_ibfk_1` FOREIGN KEY (`appid`) REFERENCES `applications` (`appid`)
) ENGINE=InnoDB AUTO_INCREMENT=254 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `locations`
--

DROP TABLE IF EXISTS `locations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `locations` (
  `locationid` int(11) NOT NULL AUTO_INCREMENT,
  `locationname` varchar(100) NOT NULL,
  `building` varchar(100) DEFAULT NULL,
  `floor` varchar(50) DEFAULT NULL,
  `room` varchar(50) DEFAULT NULL,
  `description` text,
  `mapimage` varchar(500) DEFAULT NULL COMMENT 'Path to floor map image',
  `mapwidth` int(11) DEFAULT NULL,
  `mapheight` int(11) DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`locationid`),
  UNIQUE KEY `locationname` (`locationname`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `machinerelationships`
--

DROP TABLE IF EXISTS `machinerelationships`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `machinerelationships` (
  `relationshipid` int(11) NOT NULL AUTO_INCREMENT,
  `parentmachineid` int(11) NOT NULL,
  `childmachineid` int(11) NOT NULL,
  `relationshiptypeid` int(11) NOT NULL,
  `notes` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`relationshipid`),
  UNIQUE KEY `uq_machine_relationship` (`parentmachineid`,`childmachineid`,`relationshiptypeid`),
  KEY `childmachineid` (`childmachineid`),
  KEY `relationshiptypeid` (`relationshiptypeid`),
  CONSTRAINT `machinerelationships_ibfk_1` FOREIGN KEY (`parentmachineid`) REFERENCES `machines` (`machineid`),
  CONSTRAINT `machinerelationships_ibfk_2` FOREIGN KEY (`childmachineid`) REFERENCES `machines` (`machineid`),
  CONSTRAINT `machinerelationships_ibfk_3` FOREIGN KEY (`relationshiptypeid`) REFERENCES `relationshiptypes` (`relationshiptypeid`)
) ENGINE=InnoDB AUTO_INCREMENT=208 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `machines`
--

DROP TABLE IF EXISTS `machines`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `machines` (
  `machineid` int(11) NOT NULL AUTO_INCREMENT,
  `machinenumber` varchar(50) NOT NULL COMMENT 'Business identifier (e.g., CMM01, G5QX1GT3ESF)',
  `alias` varchar(100) DEFAULT NULL COMMENT 'Friendly name',
  `hostname` varchar(100) DEFAULT NULL COMMENT 'Network hostname (for PCs)',
  `serialnumber` varchar(100) DEFAULT NULL COMMENT 'Hardware serial number',
  `machinetypeid` int(11) NOT NULL,
  `pctypeid` int(11) DEFAULT NULL COMMENT 'Set for PCs, NULL for equipment',
  `businessunitid` int(11) DEFAULT NULL,
  `modelnumberid` int(11) DEFAULT NULL,
  `vendorid` int(11) DEFAULT NULL,
  `statusid` int(11) DEFAULT NULL COMMENT 'In Use, Spare, Retired, etc.',
  `locationid` int(11) DEFAULT NULL,
  `mapleft` int(11) DEFAULT NULL COMMENT 'X coordinate on floor map',
  `maptop` int(11) DEFAULT NULL COMMENT 'Y coordinate on floor map',
  `islocationonly` tinyint(1) DEFAULT NULL COMMENT 'Virtual location marker (not actual machine)',
  `osid` int(11) DEFAULT NULL,
  `loggedinuser` varchar(100) DEFAULT NULL,
  `lastreporteddate` datetime DEFAULT NULL,
  `lastboottime` datetime DEFAULT NULL,
  `isvnc` tinyint(1) DEFAULT NULL COMMENT 'VNC remote access enabled',
  `iswinrm` tinyint(1) DEFAULT NULL COMMENT 'WinRM enabled',
  `isshopfloor` tinyint(1) DEFAULT NULL COMMENT 'Shopfloor PC',
  `requiresmanualconfig` tinyint(1) DEFAULT NULL COMMENT 'Multi-PC machine needs manual configuration',
  `notes` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  `deleteddate` datetime DEFAULT NULL,
  `deletedby` varchar(100) DEFAULT NULL,
  `createdby` varchar(100) DEFAULT NULL,
  `modifiedby` varchar(100) DEFAULT NULL,
  PRIMARY KEY (`machineid`),
  UNIQUE KEY `ix_machines_machinenumber` (`machinenumber`),
  KEY `pctypeid` (`pctypeid`),
  KEY `businessunitid` (`businessunitid`),
  KEY `modelnumberid` (`modelnumberid`),
  KEY `vendorid` (`vendorid`),
  KEY `statusid` (`statusid`),
  KEY `osid` (`osid`),
  KEY `idx_machine_active` (`isactive`),
  KEY `idx_machine_hostname` (`hostname`),
  KEY `idx_machine_type_bu` (`machinetypeid`,`businessunitid`),
  KEY `ix_machines_serialnumber` (`serialnumber`),
  KEY `ix_machines_hostname` (`hostname`),
  KEY `idx_machine_location` (`locationid`),
  CONSTRAINT `machines_ibfk_1` FOREIGN KEY (`machinetypeid`) REFERENCES `machinetypes` (`machinetypeid`),
  CONSTRAINT `machines_ibfk_2` FOREIGN KEY (`pctypeid`) REFERENCES `pctypes` (`pctypeid`),
  CONSTRAINT `machines_ibfk_3` FOREIGN KEY (`businessunitid`) REFERENCES `businessunits` (`businessunitid`),
  CONSTRAINT `machines_ibfk_4` FOREIGN KEY (`modelnumberid`) REFERENCES `models` (`modelnumberid`),
  CONSTRAINT `machines_ibfk_5` FOREIGN KEY (`vendorid`) REFERENCES `vendors` (`vendorid`),
  CONSTRAINT `machines_ibfk_6` FOREIGN KEY (`statusid`) REFERENCES `machinestatuses` (`statusid`),
  CONSTRAINT `machines_ibfk_7` FOREIGN KEY (`locationid`) REFERENCES `locations` (`locationid`),
  CONSTRAINT `machines_ibfk_8` FOREIGN KEY (`osid`) REFERENCES `operatingsystems` (`osid`)
) ENGINE=InnoDB AUTO_INCREMENT=639 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `machinestatuses`
--

DROP TABLE IF EXISTS `machinestatuses`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `machinestatuses` (
  `statusid` int(11) NOT NULL AUTO_INCREMENT,
  `status` varchar(50) NOT NULL,
  `description` text,
  `color` varchar(20) DEFAULT NULL COMMENT 'CSS color for UI',
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`statusid`),
  UNIQUE KEY `status` (`status`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `machinetypes`
--

DROP TABLE IF EXISTS `machinetypes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `machinetypes` (
  `machinetypeid` int(11) NOT NULL AUTO_INCREMENT,
  `machinetype` varchar(100) NOT NULL,
  `category` varchar(50) NOT NULL COMMENT 'Equipment, PC, Network, or Printer',
  `description` text,
  `icon` varchar(50) DEFAULT NULL COMMENT 'Icon name for UI',
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`machinetypeid`),
  UNIQUE KEY `machinetype` (`machinetype`)
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `models`
--

DROP TABLE IF EXISTS `models`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `models` (
  `modelnumberid` int(11) NOT NULL AUTO_INCREMENT,
  `modelnumber` varchar(100) NOT NULL,
  `machinetypeid` int(11) DEFAULT NULL,
  `vendorid` int(11) DEFAULT NULL,
  `description` text,
  `imageurl` varchar(500) DEFAULT NULL COMMENT 'URL to product image',
  `documentationurl` varchar(500) DEFAULT NULL COMMENT 'URL to documentation',
  `notes` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`modelnumberid`),
  UNIQUE KEY `uq_model_vendor` (`modelnumber`,`vendorid`),
  KEY `machinetypeid` (`machinetypeid`),
  KEY `vendorid` (`vendorid`),
  CONSTRAINT `models_ibfk_1` FOREIGN KEY (`machinetypeid`) REFERENCES `machinetypes` (`machinetypeid`),
  CONSTRAINT `models_ibfk_2` FOREIGN KEY (`vendorid`) REFERENCES `vendors` (`vendorid`)
) ENGINE=InnoDB AUTO_INCREMENT=105 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `operatingsystems`
--

DROP TABLE IF EXISTS `operatingsystems`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `operatingsystems` (
  `osid` int(11) NOT NULL AUTO_INCREMENT,
  `osname` varchar(100) NOT NULL,
  `osversion` varchar(50) DEFAULT NULL,
  `architecture` varchar(20) DEFAULT NULL COMMENT 'x86, x64, ARM',
  `endoflife` date DEFAULT NULL COMMENT 'End of support date',
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`osid`),
  UNIQUE KEY `uq_os_name_version` (`osname`,`osversion`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `pctypes`
--

DROP TABLE IF EXISTS `pctypes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pctypes` (
  `pctypeid` int(11) NOT NULL AUTO_INCREMENT,
  `pctype` varchar(100) NOT NULL,
  `description` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`pctypeid`),
  UNIQUE KEY `pctype` (`pctype`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `printerdata`
--

DROP TABLE IF EXISTS `printerdata`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `printerdata` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `machineid` int(11) NOT NULL,
  `windowsname` varchar(255) DEFAULT NULL COMMENT 'Windows printer name (e.g., \\\\server\\printer)',
  `sharename` varchar(100) DEFAULT NULL COMMENT 'CSF/share name',
  `iscsf` tinyint(1) DEFAULT NULL COMMENT 'Is CSF printer',
  `installpath` varchar(255) DEFAULT NULL COMMENT 'Driver install path',
  `pin` varchar(20) DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `ix_printerdata_machineid` (`machineid`),
  KEY `idx_printer_windowsname` (`windowsname`),
  CONSTRAINT `printerdata_ibfk_1` FOREIGN KEY (`machineid`) REFERENCES `machines` (`machineid`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `relationshiptypes`
--

DROP TABLE IF EXISTS `relationshiptypes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `relationshiptypes` (
  `relationshiptypeid` int(11) NOT NULL AUTO_INCREMENT,
  `relationshiptype` varchar(50) NOT NULL,
  `description` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`relationshiptypeid`),
  UNIQUE KEY `relationshiptype` (`relationshiptype`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `roles` (
  `roleid` int(11) NOT NULL AUTO_INCREMENT,
  `rolename` varchar(50) NOT NULL,
  `description` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`roleid`),
  UNIQUE KEY `rolename` (`rolename`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `supportteams`
--

DROP TABLE IF EXISTS `supportteams`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `supportteams` (
  `supportteamid` int(11) NOT NULL AUTO_INCREMENT,
  `teamname` varchar(100) NOT NULL,
  `teamurl` varchar(255) DEFAULT NULL,
  `appownerid` int(11) DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`supportteamid`),
  KEY `appownerid` (`appownerid`),
  CONSTRAINT `supportteams_ibfk_1` FOREIGN KEY (`appownerid`) REFERENCES `appowners` (`appownerid`)
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `userroles`
--

DROP TABLE IF EXISTS `userroles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `userroles` (
  `userid` int(11) NOT NULL,
  `roleid` int(11) NOT NULL,
  PRIMARY KEY (`userid`,`roleid`),
  KEY `roleid` (`roleid`),
  CONSTRAINT `userroles_ibfk_1` FOREIGN KEY (`userid`) REFERENCES `users` (`userid`),
  CONSTRAINT `userroles_ibfk_2` FOREIGN KEY (`roleid`) REFERENCES `roles` (`roleid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
/*!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` (
  `userid` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(100) NOT NULL,
  `email` varchar(255) NOT NULL,
  `passwordhash` varchar(255) NOT NULL,
  `firstname` varchar(100) DEFAULT NULL,
  `lastname` varchar(100) DEFAULT NULL,
  `lastlogindate` datetime DEFAULT NULL,
  `failedlogins` int(11) DEFAULT NULL,
  `lockeduntil` datetime DEFAULT NULL,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`userid`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `ix_users_username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `vendors`
--

DROP TABLE IF EXISTS `vendors`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendors` (
  `vendorid` int(11) NOT NULL AUTO_INCREMENT,
  `vendor` varchar(100) NOT NULL,
  `description` text,
  `website` varchar(255) DEFAULT NULL,
  `supportphone` varchar(50) DEFAULT NULL,
  `supportemail` varchar(100) DEFAULT NULL,
  `notes` text,
  `createddate` datetime NOT NULL,
  `modifieddate` datetime NOT NULL,
  `isactive` tinyint(1) NOT NULL,
  PRIMARY KEY (`vendorid`),
  UNIQUE KEY `vendor` (`vendor`)
) ENGINE=InnoDB AUTO_INCREMENT=44 DEFAULT CHARSET=latin1;
/*!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 2026-01-13 21:07:15
