MySQL implementation of the helpdesk tables

The UML UML class diagram for the helpdesk entities representing the logical model from which this is derived is listed on its own page.

--
-- Table structure for table `hd_timeinfo`
--
 
DROP TABLE IF EXISTS `hd_timeinfo`;
CREATE TABLE `hd_timeinfo` (
  `timeid` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `stime` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `atime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
  `mtime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
  `etime` TIMESTAMP NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY  (`timeid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Helpdesk Module: Start/Access/Modification/End times.';
 
--
-- Dumping data for table `hd_timeinfo`
--
 
 
/*!40000 ALTER TABLE `hd_timeinfo` DISABLE KEYS */;
LOCK TABLES `hd_timeinfo` WRITE;
UNLOCK TABLES;
/*!40000 ALTER TABLE `hd_timeinfo` ENABLE KEYS */;
 
--
-- Table structure for table `hd_user`
--
 
DROP TABLE IF EXISTS `hd_user`;
CREATE TABLE `hd_user` (
  `uid` INT(10) NOT NULL DEFAULT '0',
  `uidcustomer` INT(10) DEFAULT NULL,
  PRIMARY KEY  (`uid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Helpdesk module: users and customers';
 
--
-- Dumping data for table `hd_user`
--
 
 
/*!40000 ALTER TABLE `hd_user` DISABLE KEYS */;
LOCK TABLES `hd_user` WRITE;
INSERT INTO `hd_user` VALUES (4,5),(5,5);
UNLOCK TABLES;
/*!40000 ALTER TABLE `hd_user` ENABLE KEYS */;
 
--
-- Table structure for table `hd_contract`
--
 
DROP TABLE IF EXISTS `hd_contract`;
CREATE TABLE `hd_contract` (
  `nid` INT(10) NOT NULL DEFAULT '0',
  `timeid` INT(10) NOT NULL DEFAULT '0',
  `uidcustomer` INT(10) NOT NULL DEFAULT '0',
  `maxdate` datetime DEFAULT NULL,
  `maxtime` datetime DEFAULT NULL,
  `maxissue` INT(10) DEFAULT NULL,
  `usemaxdate` tinyint(1) NOT NULL DEFAULT '0',
  `usemaxtime` tinyint(1) NOT NULL DEFAULT '0',
  `usemaxissue` tinyint(1) NOT NULL DEFAULT '0',
  `deftimeincrement` INT(10) DEFAULT '1',
  `issuspended` INT(1) NOT NULL DEFAULT '0',
  PRIMARY KEY  (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Helpdesk module : contract parameters';
 
--
-- Dumping data for table `hd_contract`
--
 
 
/*!40000 ALTER TABLE `hd_contract` DISABLE KEYS */;
LOCK TABLES `hd_contract` WRITE;
UNLOCK TABLES;
/*!40000 ALTER TABLE `hd_contract` ENABLE KEYS */;
 
--
-- Table structure for table `hd_event`
--
 
DROP TABLE IF EXISTS `hd_event`;
CREATE TABLE `hd_event` (
  `nid` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `timeid` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `description` text NOT NULL,
  `contractid` INT(10) DEFAULT NULL,
  `txnid` INT(10) UNSIGNED DEFAULT NULL,
  `nidparent` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `nidroot` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `tidseverity` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `tidstatus` INT(10) UNSIGNED NOT NULL DEFAULT '0',
  `uidtech` INT(10) UNSIGNED DEFAULT NULL,
  `tempcontact` text,
  `attachment` mediumblob,
  PRIMARY KEY  (`nid`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Helpdesk module: Ticket and followup events';
 
--
-- Dumping data for table `hd_event`
--
 
 
/*!40000 ALTER TABLE `hd_event` DISABLE KEYS */;
LOCK TABLES `hd_event` WRITE;
INSERT INTO `hd_event` VALUES (45,0,'',NULL,NULL,45,45,0,44,NULL,NULL,NULL),(47,0,'',NULL,NULL,47,47,0,0,NULL,NULL,NULL);
UNLOCK TABLES;
/*!40000 ALTER TABLE `hd_event` ENABLE KEYS */;