
SET IGNORECASE TRUE;

CREATE TABLE `tadcampaigns` (
  `campaignID` char(35) NOT NULL,
  `userID` char(35) default NULL,
  `dateCreated` datetime default NULL,
  `lastUpdate` datetime default NULL,
  `lastUpdateBy` varchar(50) default NULL,
  `name` varchar(50) default NULL,
  `startDate` datetime default NULL,
  `endDate` datetime default NULL,
  `isActive` int(10) default NULL,
  `notes` longtext,
  PRIMARY KEY (`campaignID`)
);


CREATE TABLE `tadcreatives` (
  `creativeID` char(35) NOT NULL,
  `userID` char(35) default NULL,
  `dateCreated` datetime default NULL,
  `lastUpdate` datetime default NULL,
  `lastUpdateBy` varchar(50) default NULL,
  `name` varchar(50) default NULL,
  `creativeType` varchar(50) default NULL,
  `fileID` char(35) default NULL,
  `mediaType` varchar(50) default NULL,
  `redirectURL` varchar(200) default NULL,
  `altText` varchar(200) default NULL,
  `notes` longtext,
  `isActive` int(10) default NULL,
  `height` int(10) default NULL,
  `width` int(10) default NULL,
  `textBody` longtext,
  PRIMARY KEY  (`creativeID`)
);


CREATE TABLE `tadipwhitelist` (
  `IP` varchar(50) NOT NULL,
  `siteID` varchar(25) NOT NULL
);


CREATE TABLE `tadplacementdetails` (
  `detailID` INTEGER NOT NULL AUTO_INCREMENT,
  `placementID` char(35) NOT NULL,
  `PlacementType` varchar(50) NOT NULL,
  `PlacementValue` int(10) NOT NULL default '0',
   PRIMARY KEY  (`detailID`)
);


CREATE TABLE `tadplacements` (
  `placementID` char(35) NOT NULL,
  `campaignID` char(35) default NULL,
  `adZoneID` char(35) default NULL,
  `creativeID` char(50) default NULL,
  `dateCreated` datetime default NULL,
  `lastUpdate` datetime default NULL,
  `lastUpdateBy` varchar(50) default NULL,
  `startDate` datetime default NULL,
  `endDate` datetime default NULL,
  `costPerImp` decimal(18,5) default NULL,
  `costPerClick` decimal(18,2) default NULL,
  `isExclusive` int(10) default NULL,
  `billable` decimal(18,2) default NULL,
  `budget` int(10) default NULL,
  `isActive` int(10) default NULL,
  `notes` longtext,
  PRIMARY KEY  (`placementID`)
);


CREATE TABLE `tadstats` (
  `statID` INTEGER NOT NULL AUTO_INCREMENT,
  `PlacementID` char(35) default NULL,
  `StatHour` int(10) default NULL,
  `StatDate` datetime default NULL,
  `Type` varchar(50) default NULL,
  `counter` int(10) default NULL,
   PRIMARY KEY  (`statID`)
);


CREATE TABLE `tadzones` (
  `adZoneID` char(35) NOT NULL,
  `siteID` varchar(25) default NULL,
  `dateCreated` datetime default NULL,
  `lastUpdate` datetime default NULL,
  `lastUpdateBy` varchar(50) default NULL,
  `name` varchar(50) default NULL,
  `creativeType` varchar(50) default NULL,
  `notes` longtext,
  `isActive` int(10) default NULL,
  `height` int(10) default NULL,
  `width` int(10) default NULL,
   PRIMARY KEY  (`adZoneID`)
);


CREATE TABLE `tcaptcha` (
  `LetterID` int(10) NOT NULL default '0',
  `Letter` char(1) default NULL,
  `ImageFile` varchar(50) default NULL
);


INSERT INTO `tcaptcha` (`LetterID`,`Letter`,`ImageFile`) VALUES
(1,'a','a.gif'),
(2,'b','b.gif'),
(3,'c','c.gif'),
(4,'d','d.gif'),
(5,'e','e.gif'),
(6,'f','f.gif'),
(7,'g','g.gif'),
(8,'h','h.gif'),
(9,'i','i.gif'),
(10,'j','j.gif'),
(11,'k','k.gif'),
(12,'l','l.gif'),
(13,'m','m.gif'),
(14,'n','n.gif'),
(15,'o','o.gif'),
(16,'p','p.gif'),
(17,'q','q.gif'),
(18,'r','r.gif'),
(19,'s','s.gif'),
(20,'t','t.gif'),
(21,'u','u.gif'),
(22,'v','v.gif'),
(23,'w','w.gif'),
(24,'x','x.gif'),
(25,'y','y.gif'),
(26,'z','z.gif');


CREATE TABLE `tcontent` (
  `TContent_ID` INTEGER NOT NULL AUTO_INCREMENT,
  `SiteID` varchar(25) default NULL,
  `ModuleID` varchar(35) default NULL,
  `ParentID` varchar(35) default NULL,
  `ContentID` varchar(35) default NULL,
  `ContentHistID` varchar(35) default NULL,
  `RemoteID` varchar(255) default NULL,
  `RemoteURL` varchar(255) default NULL,
  `RemotePubDate` varchar(50) default NULL,
  `RemoteSourceURL` varchar(255) default NULL,
  `RemoteSource` varchar(255) default NULL,
  `Credits` varchar(255) default NULL,
  `FileID` varchar(35) default NULL,
  `Template` varchar(50) default NULL,
  `Type` varchar(25) default NULL,
  `subType` varchar(25) default NULL,
  `Active` tinyint(3) default '0',
  `OrderNo` int(10) default NULL,
  `Title` varchar(255) default NULL,
  `MenuTitle` varchar(255) default NULL,
  `Summary` longtext,
  `Filename` varchar(255) default NULL,
  `MetaDesc` longtext,
  `MetaKeyWords` longtext,
  `Body` longtext,
  `lastUpdate` datetime default NULL,
  `lastUpdateBy` varchar(50) default NULL,
  `lastUpdateByID` varchar(50) default NULL,
  `DisplayStart` datetime default NULL,
  `DisplayStop` datetime default NULL,
  `Display` tinyint(3) default NULL,
  `Approved` tinyint(3) default NULL,
  `IsNav` tinyint(3) default NULL,
  `Restricted` tinyint(3) default NULL,
  `RestrictGroups` varchar(255) default NULL,
  `Target` varchar(50) default NULL,
  `TargetParams` varchar(255) default NULL,
  `responseChart` tinyint(3) default NULL,
  `responseMessage` longtext,
  `responseSendTo` longtext,
  `responseDisplayFields` longtext,
  `moduleAssign` varchar(255) default NULL,
  `displayTitle` tinyint(3) default NULL,
  `Notes` longtext,
  `inheritObjects` varchar(25) default NULL,
  `isFeature` tinyint(3) default NULL,
  `ReleaseDate` datetime default NULL,
  `IsLocked` tinyint(3) default NULL,
  `nextN` int(10) default NULL,
  `sortBy` varchar(50) default NULL,
  `sortDirection` varchar(50) default NULL,
  `featureStart` datetime default NULL,
  `featureStop` datetime default NULL,
  `forceSSL` tinyint(3) NOT NULL default '0',
  `audience` longtext,
  `keyPoints` longtext,
  `searchExclude` tinyint(3) default NULL,
  `path` longtext,
  `tags` longtext,
  PRIMARY KEY (`TContent_ID`)

);

CREATE INDEX IX_TContent ON tcontent(ContentID);
CREATE INDEX IX_TContent_1 ON tcontent(ContentHistID);
CREATE INDEX IX_TContent_2 ON tcontent(SiteID);
CREATE INDEX IX_TContent_3 ON tcontent(ParentID);
CREATE INDEX IX_TContent_4 ON tcontent(RemoteID);


INSERT INTO `tcontent` (`SiteID`,`ModuleID`,`ParentID`,`ContentID`,`ContentHistID`,`RemoteID`,`RemoteURL`,`RemotePubDate`,`RemoteSourceURL`,`RemoteSource`,`Credits`,`FileID`,`Template`,`Type`,`subType`,`Active`,`OrderNo`,`Title`,`MenuTitle`,`Summary`,`Filename`,`MetaDesc`,`MetaKeyWords`,`Body`,`lastUpdate`,`lastUpdateBy`,`lastUpdateByID`,`DisplayStart`,`DisplayStop`,`Display`,`Approved`,`IsNav`,`Restricted`,`RestrictGroups`,`Target`,`TargetParams`,`responseChart`,`responseMessage`,`responseSendTo`,`responseDisplayFields`,`moduleAssign`,`displayTitle`,`Notes`,`inheritObjects`,`isFeature`,`ReleaseDate`,`IsLocked`,`nextN`,`sortBy`,`sortDirection`,`featureStart`,`featureStop`,`forceSSL`,`audience`,`keyPoints`,`searchExclude`,`path`,`tags`) VALUES 
('default','00000000000000000000000000000000003','00000000000000000000000000000000END','00000000000000000000000000000000003','6300ED4A-1320-5CC3-F9D6A2D279E386D0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Components',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,NULL), 
('default','00000000000000000000000000000000004','00000000000000000000000000000000END','00000000000000000000000000000000004','6300ED59-1320-5CC3-F9706221E0EFF7A2',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Forms',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000000','00000000000000000000000000000000END','00000000000000000000000000000000001','6300ED69-1320-5CC3-F922E3012E2C6BAE',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'default.cfm','Page','Default',1,1,'Home','Home',NULL,NULL,NULL,NULL,NULL,'2007-09-24 16:49:00','System',NULL,NULL,NULL,1,1,1,0,NULL,NULL,NULL,0,NULL,NULL,NULL,NULL,0,NULL,'Cascade',0,NULL,0,10,'orderno','asc',NULL,NULL,0,NULL,NULL,0,'''00000000000000000000000000000000001''',NULL),
('default','00000000000000000000000000000000006','00000000000000000000000000000000END','00000000000000000000000000000000006','6300ED79-1320-5CC3-F92E6325C26664B6',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Advertising',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000000','00000000000000000000000000000000END','00000000000000000000000000000000000','6300ED88-1320-5CC3-F9E241684D21FEC9',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Site Manager',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000008','00000000000000000000000000000000END','00000000000000000000000000000000008','6300ED98-1320-5CC3-F9398EB23A57CBD0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Site Members',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000005','00000000000000000000000000000000END','00000000000000000000000000000000005','6300EDA8-1320-5CC3-F93DF074187C935E',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Email Broadcaster',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000009','00000000000000000000000000000000END','00000000000000000000000000000000009','6300EDB7-1320-5CC3-F9D664F38EBBD2D0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Mailing Lists',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000010','00000000000000000000000000000000END','00000000000000000000000000000000010','6300EDC7-1320-5CC3-F9DB8034C9626B70',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Categories',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000011','00000000000000000000000000000000END','00000000000000000000000000000000011','6300EDD6-1320-5CC3-F9625545444B880F',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Content Collections',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL),
('default','00000000000000000000000000000000012','00000000000000000000000000000000END','00000000000000000000000000000000012','6300EDE6-1320-5CC3-F94E2FCEF5DE046D',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'Module','Default',1,NULL,'Filemanager Manager',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,1,1,1,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL);


CREATE TABLE `tcontentstats` (
  `contentID` char(35) NOT NULL default '',
  `siteID` varchar(25) NOT NULL default '',
  `views` int(10) NOT NULL default '0',
  `rating` float NOT NULL default '0',
  `totalVotes` int(10) NOT NULL default '0',
  `upVotes` int(10) NOT NULL default '0',
  `downVotes` int(10) NOT NULL default '0',
  `comments` int(10) NOT NULL default '0',
  PRIMARY KEY  (`contentID`,`siteID`)
);



CREATE TABLE `tcontentassignments` (
  `contentID` char(35) NOT NULL,
  `contentHistID` char(35) NOT NULL,
  `siteID` varchar(50) NOT NULL,
  `userID` varchar(35) NOT NULL,
  PRIMARY KEY  (`contentID`,`contentHistID`,`siteID`,`userID`)
);



CREATE TABLE `tcontentcategories` (
  `categoryID` char(35) NOT NULL,
  `siteID` varchar(25) default NULL,
  `parentID` char(35) default NULL,
  `dateCreated` datetime default NULL,
  `lastUpdate` datetime default NULL,
  `lastUpdateBy` varchar(50) default NULL,
  `name` varchar(50) default NULL,
  `notes` longtext,
  `isInterestGroup` int(10) default NULL,
  `isActive` int(10) default NULL,
  `isOpen` int(10) default NULL,
  `sortBy` varchar(50) default NULL,
  `sortDirection` varchar(50) default NULL,
  `restrictGroups` varchar(255) default NULL,
  `path` longtext,
  PRIMARY KEY  (`categoryID`)
);

CREATE INDEX IX_TContentCategories ON tcontentcategories(siteID);


CREATE TABLE `tcontentcategoryassign` (
  `contentHistID` char(35) NOT NULL,
  `categoryID` char(35) NOT NULL,
  `contentID` char(35) default NULL,
  `isFeature` int(10) default NULL,
  `orderno` int(10) default NULL,
  `siteID` varchar(25) default NULL,
  `featureStart` datetime default NULL,
  `featureStop` datetime default NULL,
  PRIMARY KEY  (`contentHistID`,`categoryID`)
);


CREATE TABLE `tcontentcomments` (
  `commentid` char(35) NOT NULL,
  `contentid` char(35) default NULL,
  `contenthistid` char(35) default NULL,
  `url` varchar(50) default NULL,
  `name` varchar(50) default NULL,
  `comments` longtext,
  `entered` datetime default NULL,
  `email` varchar(100) default NULL,
  `siteid` varchar(50) default NULL,
  `ip` varchar(50) default NULL,
  `isApproved` tinyint(3) default '0',
  PRIMARY KEY  (`commentid`)
);

CREATE INDEX IX_TContentComments ON tcontentcomments(contentid);

CREATE TABLE `tcontentdisplaytitleapprovals` (
  `contentid` char(35) NOT NULL,
  `isApproved` tinyint(3) default NULL,
  `email` varchar(150) default NULL,
  `siteid` varchar(25) default NULL
);



CREATE TABLE `tcontenteventreminders` (
  `contentId` char(35) NOT NULL,
  `siteId` varchar(25) NOT NULL,
  `email` varchar(200) NOT NULL,
  `RemindDate` datetime default NULL,
  `RemindHour` int(10) default NULL,
  `RemindMinute` int(10) default NULL,
  `RemindInterval` int(10) default NULL,
  `isSent` int(10) default NULL
);



CREATE TABLE `tcontentfeedadvancedparams` (
  `paramID` char(35) NOT NULL,
  `feedID` char(35) NOT NULL,
  `param` decimal(18,0) default NULL,
  `relationship` varchar(50) default NULL,
  `field` varchar(100) default NULL,
  `condition` varchar(50) default NULL,
  `criteria` varchar(200) default NULL,
  `dataType` varchar(50) default NULL,
  PRIMARY KEY  (`paramID`)
);


CREATE TABLE `tcontentfeeditems` (
  `feedID` char(35) NOT NULL,
  `itemID` char(35) NOT NULL,
  `type` varchar(50) default NULL
);



CREATE TABLE `tcontentfeeds` (
  `feedID` char(35) NOT NULL,
  `siteID` varchar(25) default NULL,
  `parentID` char(35) default NULL,
  `name` varchar(250) default NULL,
  `isActive` tinyint(3) default NULL,
  `isPublic` tinyint(3) default NULL,
  `isDefault` tinyint(3) default NULL,
  `isFeaturesOnly` tinyint(3) default NULL,
  `description` longtext,
  `maxItems` int(10) default NULL,
  `allowHTML` tinyint(3) default NULL,
  `lang` varchar(50) default NULL,
  `lastUpdateBy` varchar(100) default NULL,
  `lastUpdate` datetime default NULL,
  `dateCreated` datetime default NULL,
  `restricted` tinyint(3) default NULL,
  `restrictGroups` longtext,
  `version` varchar(50) default NULL,
  `channelLink` varchar(250) default NULL,
  `Type` varchar(50) default NULL,
  `sortBy` varchar(50) default NULL,
  `sortDirection` varchar(50) default NULL,
  `nextN` int(10) default NULL,
  `displayName` tinyint(3) default NULL,
  `displayRatings` tinyint(3) default NULL,
  `displayComments` tinyint(3) default NULL,
  PRIMARY KEY  (`feedID`)
);

CREATE INDEX IX_TContentFeeds ON tcontentfeeds(siteID);


CREATE TABLE `tcontentobjects` (
  `ContentHistID` char(35) NOT NULL,
  `ObjectID` varchar(100) NOT NULL,
  `Object` varchar(50) NOT NULL,
  `ContentID` char(35) default NULL,
  `Name` varchar(255) default NULL,
  `OrderNo` int(10) default NULL,
  `SiteID` varchar(25) default NULL,
  `ColumnID` int(10) default NOT NULL,
  PRIMARY KEY  (`ContentHistID`,`ObjectID`,`Object`,`ColumnID`)
);

CREATE INDEX IX_TContentObjects ON tcontentobjects(siteID);


CREATE TABLE `tcontentratings` (
  `contentID` char(35) NOT NULL,
  `userID` char(35) NOT NULL,
  `siteID` varchar(25) NOT NULL,
  `rate` int(10) default NULL,
  `entered` timestamp NULL default CURRENT_TIMESTAMP,
  PRIMARY KEY  (`contentID`,`userID`,`siteID`)
);

CREATE INDEX IDX_ENTERED ON tcontentratings(entered);


CREATE TABLE `tcontentrelated` (
  `contentHistID` char(35) NOT NULL,
  `relatedID` char(35) NOT NULL,
  `contentID` char(35) NOT NULL,
  `siteID` varchar(25) NOT NULL,
  PRIMARY KEY  (`contentHistID`,`relatedID`,`contentID`,`siteID`)
);



CREATE TABLE `temailreturnstats` (
  `emailID` char(35) default NULL,
  `email` varchar(100) default NULL,
  `url` mediumtext,
  `created` datetime default NULL
);


CREATE TABLE `temails` (
  `EmailID` char(35) NOT NULL,
  `siteid` varchar(25) default NULL,
  `Subject` varchar(255) default NULL,
  `BodyText` longtext,
  `BodyHtml` longtext,
  `CreatedDate` datetime default NULL,
  `DeliveryDate` datetime default NULL,
  `status` tinyint(3) default NULL,
  `GroupList` longtext,
  `LastUpdateBy` varchar(50) default NULL,
  `LastUpdateByID` varchar(35) default NULL,
  `NumberSent` int(10) NOT NULL default '0',
  `ReplyTo` varchar(50) default NULL,
  `format` varchar(50) default NULL,
  `fromLabel` varchar(50) default NULL,
  `isDeleted` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`EmailID`)
);

CREATE INDEX IX_TEmails ON temails(siteid);


CREATE TABLE `temailstats` (
  `EmailID` char(35) default NULL,
  `Email` varchar(100) default NULL,
  `emailOpen` int(10) NOT NULL default '0',
  `returnClick` int(10) NOT NULL default '0',
  `bounce` int(10) NOT NULL default '0',
  `sent` int(10) NOT NULL default '0',
  `Created` datetime default NULL
);


CREATE TABLE `tfiles` (
  `fileID` char(35) NOT NULL,
  `contentID` char(35) default NULL,
  `siteID` varchar(25) default NULL,
  `moduleID` char(35) default NULL,
  `filename` varchar(200) default NULL,
  `image` longblob,
  `imageSmall` longblob,
  `imageMedium` longblob,
  `fileSize` int(10) default NULL,
  `contentType` varchar(100) default NULL,
  `contentSubType` varchar(200) default NULL,
  `fileExt` varchar(50) default NULL,
  `created` datetime default NULL,
  PRIMARY KEY  (`fileID`)
);



CREATE TABLE `tformresponsepackets` (
  `ResponseID` char(35) NOT NULL,
  `FormID` char(50) default NULL,
  `SiteID` varchar(25) default NULL,
  `FieldList` longtext,
  `Data` longtext,
  `Entered` datetime default NULL,
  PRIMARY KEY  (`ResponseID`)
);

CREATE INDEX IX_TFormResponsePackets ON tformresponsepackets(FormID,SiteID);


CREATE TABLE `tformresponsequestions` (
  `responseID` char(35) default NULL,
  `formID` char(35) default NULL,
  `formField` varchar(50) default NULL,
  `formValue` longtext,
  `pollValue` varchar(255) default NULL
);




CREATE TABLE `tglobals` (
  `appreload` datetime default NULL,
  `loadlist` mediumtext
);



CREATE TABLE `tmailinglist` (
  `MLID` char(35) default NULL,
  `SiteID` varchar(25) default NULL,
  `Name` varchar(50) default NULL,
  `Description` longtext,
  `LastUpdate` datetime default NULL,
  `isPurge` int(10) default NULL,
  `isPublic` int(10) default NULL
);


INSERT INTO `tmailinglist` (`MLID`,`SiteID`,`Name`,`Description`,`LastUpdate`,`isPurge`,`isPublic`) VALUES 
 ('22FC551F-FABE-EA01-C6EDD0885DDC1680','default','Please Remove Me from All Lists','','2007-09-24 16:49:00',1,1);


CREATE TABLE `tmailinglistmembers` (
  `MLID` char(35) default NULL,
  `Email` varchar(100) default NULL,
  `SiteID` varchar(25) default NULL,
  `fname` varchar(50) default NULL,
  `lname` varchar(50) default NULL,
  `company` varchar(50) default NULL,
  `isVerified` tinyint(1) NOT NULL default '0'
);



CREATE TABLE `tpermissions` (
  `ContentID` char(35) default NULL,
  `GroupID` char(35) default NULL,
  `SiteID` varchar(25) default NULL,
  `Type` varchar(50) default NULL
);


CREATE TABLE `tredirects` (
  `redirectID` char(35) NOT NULL,
  `URL` mediumtext,
  `created` datetime default NULL,
  PRIMARY KEY  (`redirectID`)
);



CREATE TABLE `tsessiontracking` (
  `trackingID` INTEGER NOT NULL AUTO_INCREMENT,
  `contentID` char(35) default NULL,
  `siteID` varchar(25) default NULL,
  `userid` char(35) default NULL,
  `remote_addr` varchar(50) default NULL,
  `server_name` varchar(50) default NULL,
  `query_string` mediumtext,
  `referer` varchar(255) default NULL,
  `user_agent` varchar(200) default NULL,
  `script_name` varchar(200) default NULL,
  `urlToken` varchar(130) NOT NULL,
  `entered` datetime NOT NULL default '0000-00-00 00:00:00',
  `country` varchar(50) default NULL,
  `lang` varchar(50) default NULL,
  `locale` varchar(50) default NULL,
  `keywords` varchar(200) default NULL,
  `originalUrlToken` varchar(130) default NULL,
  PRIMARY KEY  (`trackingID`)
);

CREATE INDEX IX_TSessionTracking ON tsessiontracking(siteID);
CREATE INDEX IX_TSessionTracking_1 ON tsessiontracking(contentID);
CREATE INDEX IX_TSessionTracking_2 ON tsessiontracking(urlToken);
CREATE INDEX IX_TSessionTracking_3 ON tsessiontracking(entered);
CREATE INDEX IX_TSessionTracking_4 ON tsessiontracking(userID);


CREATE TABLE `tsystemobjects` (
  `Object` varchar(50) default NULL,
  `SiteID` varchar(25) default NULL,
  `Name` varchar(50) default NULL,
  `OrderNo` int(10) default NULL
);

INSERT INTO `tsystemobjects` (`Object`,`SiteID`,`Name`,`OrderNo`) VALUES 
 ('event_reminder_form','default','Event Reminder Form',12),
 ('forward_email','default','Forward Email',13),
 ('site_map','default','Site Map',2),
 ('peer_nav','default','Peer Navigation',3),
 ('sub_nav','default','Sub Navigation',4),
 ('standard_nav','default','Standard Navigation',5),
 ('portal_nav','default','Portal Navigation',6),
 ('comments','default','Accept Comments',9),
 ('seq_nav','default','Sequential Nav',8),
 ('payPalCart','default','PayPal Shopping Cart',14),
 ('rater','default','Content Rater',16),
 ('favorites','default','User Favorites',17),
 ('dragable_feeds','default','Dragable Feeds',18),
 ('related_content','default','Related Content',19),
 ('user_tools','default','User Tools',20),
 ('tag_cloud','default','Tag Cloud',21),
 ('goToFirstChild','default','Go To First Child',23);


CREATE TABLE `tuseraddresses` (
  `addressID` char(35) NOT NULL,
  `userID` char(35) default NULL,
  `siteID` varchar(25) default NULL,
  `addressName` varchar(50) default NULL,
  `address1` varchar(50) default NULL,
  `address2` varchar(50) default NULL,
  `city` varchar(50) default NULL,
  `state` varchar(50) default NULL,
  `zip` varchar(50) default NULL,
  `country` varchar(50) default NULL,
  `phone` varchar(50) default NULL,
  `fax` varchar(50) default NULL,
  `isPrimary` tinyint(3) default NULL,
  `addressNotes` longtext,
  `addressURL` varchar(200) default NULL,
  `longitude` float default NULL,
  `latitude` float default NULL,
  `addressEmail` varchar(100) default NULL,
  `hours` longtext,
  PRIMARY KEY  (`addressID`)
);

CREATE INDEX IX_tuseraddresses_2 ON tuseraddresses(longitude);
CREATE INDEX IX_tuseraddresses_3 ON tuseraddresses(latitude);
CREATE INDEX IX_tuseraddresses_4 ON tuseraddresses(userID);


CREATE TABLE `tusersfavorites` (
  `favoriteID` char(35) NOT NULL,
  `userID` char(35) NOT NULL,
  `favoriteName` varchar(100) default NULL,
  `favorite` mediumtext NOT NULL,
  `type` varchar(30) NOT NULL,
  `siteID` varchar(25) default NULL,
  `dateCreated` timestamp NOT NULL default CURRENT_TIMESTAMP,
  `columnNumber` int(10) default NULL,
  `rowNumber` int(10) default NULL,
  `maxRSSItems` int(10) default NULL,
  PRIMARY KEY  (`favoriteID`)
);



CREATE TABLE `tusersinterests` (
  `userID` char(35) default NOT NULL,
  `categoryID` char(35) default NOT NULL,
  PRIMARY KEY  (`UserID`,`categoryID`)
);



CREATE TABLE `tusersmemb` (
  `UserID` char(35) NOT NULL,
  `GroupID` char(35) NOT NULL,
  PRIMARY KEY  (`UserID`,`GroupID`)
);



CREATE TABLE  `tcontentpublicsubmissionapprovals` (
  `contentID` char(35) NOT NULL,
  `isApproved` int(10) NOT NULL,
  `email` varchar(150) NOT NULL,
  `siteID` varchar(25) NOT NULL,
  PRIMARY KEY  (`contentID`,`siteID`)
);


CREATE TABLE `tcontenttags` (
  `tagID` INTEGER NOT NULL AUTO_INCREMENT,
  `contentID` CHAR(35) NOT NULL,
  `contentHistID` CHAR(35) NOT NULL,
  `siteID` VARCHAR(25) NOT NULL,
  `tag` VARCHAR(100) NOT NULL,
  PRIMARY KEY (`tagID`)
);

CREATE INDEX IX_tcontenttags_2 ON tcontenttags(contentHistID);
CREATE INDEX IX_tcontenttags_3 ON tcontenttags(siteID);
CREATE INDEX IX_tcontenttags_4 ON tcontenttags(contentID);
CREATE INDEX IX_tcontenttags_5 ON tcontenttags(tag);


CREATE TABLE `tuserstags` (
  `tagID` INTEGER NOT NULL AUTO_INCREMENT,
  `userID` CHAR(35) NOT NULL,
  `siteID` VARCHAR(25) NOT NULL,
  `tag` VARCHAR(100) NOT NULL,
  PRIMARY KEY (`tagID`)
);

CREATE INDEX IX_tuserstags_2 ON tuserstags(userID);
CREATE INDEX IX_tuserstags_3 ON tuserstags(siteID);
CREATE INDEX IX_tuserstags_4 ON tuserstags(tag);


CREATE TABLE `tclassextenddatauseractivity`  (
	`dataID` INTEGER NOT NULL AUTO_INCREMENT,
	`baseID` char (35)  NOT NULL ,
	`attributeID` INTEGER NOT NULL ,
	`siteID` varchar (25)  NULL ,
	`attributeValue` longtext,
	PRIMARY KEY (`dataID`)
);

CREATE INDEX IX_tclassextenddatauseractivity_2 ON tclassextenddatauseractivity(baseID);
CREATE INDEX IX_tclassextenddatauseractivity_3 ON tclassextenddatauseractivity(attributeID);


CREATE TABLE `tclassextenddata`  (
	`dataID` INTEGER NOT NULL AUTO_INCREMENT,
	`baseID` char (35)  NOT NULL ,
	`attributeID`INTEGER NOT NULL ,
	`siteID` varchar (25)  NULL ,
	`attributeValue` longtext,
	PRIMARY KEY (`dataID`)
);

CREATE INDEX IX_tclassextenddata_2 ON tclassextenddata(baseID);
CREATE INDEX IX_tclassextenddata_3 ON tclassextenddata(attributeID);


CREATE TABLE `tclassextend` (
	`subTypeID` char (35)  NOT NULL ,
	`siteID` varchar (25)  NULL ,
	`baseTable` varchar (50) NULL ,
	`baseKeyField` varchar (50) NULL ,
	`dataTable` varchar (50) NULL ,
	`type` varchar (50) NULL ,
	`subType` varchar (50) NULL ,
	`isActive` tinyint(3) NULL ,
	`notes` longtext ,
	`lastUpdate` datetime NULL ,
	`dateCreated` datetime NULL ,
	`lastUpdateBy` varchar (100)  NULL ,
	PRIMARY KEY (`subTypeID`)
);


CREATE TABLE `tclassextendattributes` (
	`attributeID`  INTEGER NOT NULL AUTO_INCREMENT,
	`extendSetID` char (35)  NULL ,
	`siteID` varchar (25) NULL ,
	`name` varchar (100) NULL ,
	`label` text NULL ,
	`hint` text  NULL ,
	`type` varchar (100) NULL ,
	`orderno` int NULL ,
	`isActive` tinyint(3) NULL ,
	`required` varchar(50) NULL ,
	`validation` varchar (50) NULL ,
	`regex` text  ,
	`message` text ,
	`defaultValue` varchar (100) NULL ,
	`optionList` longtext ,
	`optionLabelList` longtext,
	PRIMARY KEY (`attributeID`)
);

CREATE INDEX IX_tclassextendattributes_2 ON tclassextendattributes(extendSetID);


CREATE TABLE `tclassextendsets` (
	`extendSetID` char(35) NOT NULL ,
	`subTypeID` char(35) NULL ,
	`categoryID` longtext ,
	`siteID` varchar (25) NULL ,
	`name` varchar(50)  NULL ,
	`orderno` int NULL ,
	`isActive` tinyint(3) NULL,
	PRIMARY KEY (`extendSetID`)
);

CREATE INDEX IX_tclassextendsets_2 ON tclassextendsets(subTypeID);


