CREATE TABLE `Tickets` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `EffectiveId` int(11) NOT NULL DEFAULT 0,
  `Queue` int(11) NOT NULL DEFAULT 0,
  `Type` varchar(16) DEFAULT NULL,
  `IssueStatement` int(11) NOT NULL DEFAULT 0,
  `Resolution` int(11) NOT NULL DEFAULT 0,
  `Owner` int(11) NOT NULL DEFAULT 0,
  `Subject` varchar(200) DEFAULT '[no subject]',
  `InitialPriority` int(11) NOT NULL DEFAULT 0,
  `FinalPriority` int(11) NOT NULL DEFAULT 0,
  `Priority` int(11) NOT NULL DEFAULT 0,
  `TimeEstimated` int(11) NOT NULL DEFAULT 0,
  `TimeWorked` int(11) NOT NULL DEFAULT 0,
  `Status` varchar(10) DEFAULT NULL,
  `TimeLeft` int(11) NOT NULL DEFAULT 0,
  `Told` datetime DEFAULT NULL,
  `Starts` datetime DEFAULT NULL,
  `Started` datetime DEFAULT NULL,
  `Due` datetime DEFAULT NULL,
  `Resolved` datetime DEFAULT NULL,
  `LastUpdatedBy` int(11) NOT NULL DEFAULT 0,
  `LastUpdated` datetime DEFAULT NULL,
  `Creator` int(11) NOT NULL DEFAULT 0,
  `Created` datetime DEFAULT NULL,
  `Disabled` smallint(6) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `Tickets1` (`Queue`,`Status`),
  KEY `Tickets2` (`Owner`),
  KEY `Tickets6` (`EffectiveId`,`Type`),
  KEY `Tickets3` (`Queue`),
  KEY `created` (`Owner`,`Created`),
  KEY `apid_status` (`Status`),
  KEY `apid_owner` (`Owner`),
  KEY `apid_type` (`Type`),
  KEY `apid_effectiveid` (`EffectiveId`),
  KEY `apid_created` (`Created`),
  KEY `apid_lastupdated` (`LastUpdated`),
  KEY `apid_subject` (`Subject`)
) ENGINE=InnoDB AUTO_INCREMENT=1607732 DEFAULT CHARSET=latin1;

CREATE TABLE `Groups` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(200) DEFAULT NULL,
  `Description` varchar(255) DEFAULT NULL,
  `Domain` varchar(64) DEFAULT NULL,
  `Type` varchar(64) DEFAULT NULL,
  `Instance` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `Groups1` (`Domain`,`Instance`,`Type`,`id`),
  KEY `Groups2` (`Type`,`Instance`)
) ENGINE=InnoDB AUTO_INCREMENT=6798838 DEFAULT CHARSET=latin1;

CREATE TABLE `CachedGroupMembers` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `GroupId` int(11) DEFAULT NULL,
  `MemberId` int(11) DEFAULT NULL,
  `Via` int(11) DEFAULT NULL,
  `ImmediateParentId` int(11) DEFAULT NULL,
  `Disabled` smallint(6) NOT NULL DEFAULT 0,
  PRIMARY KEY (`id`),
  KEY `DisGrouMem` (`GroupId`,`MemberId`,`Disabled`),
  KEY `main` (`MemberId`),
  KEY `SHREDDER_CGM1` (`MemberId`,`GroupId`,`Disabled`)
) ENGINE=InnoDB AUTO_INCREMENT=17034592 DEFAULT CHARSET=latin1;
