CREATE TABLE `cmsSettings` (
  `ID` int(20) NOT NULL auto_increment,
  `SettingKey` varchar(50) default NULL,
  `SettingValue` varchar(200) default NULL,
  `SettingType` varchar(15) default NULL,
  `SettingIsReadOnly` int(11) default '0',
  `SettingOptions` varchar(200) default NULL,
  `SettingComments` varchar(200) default NULL,
  `SettingGroup` varchar(50) default NULL,
  PRIMARY KEY  (`ID`),
  KEY `ID` (`ID`),
  KEY `SettingKey` (`SettingKey`)
) ENGINE=InnoDB; 

CREATE TABLE `ContentScripts` (
  `ID` int(20) NOT NULL auto_increment,
  `Name` varchar(50) default NULL,
  `Code` text,
  PRIMARY KEY  (`ID`),
  KEY `Name` (`Name`)
) ENGINE=InnoDB; 

CREATE TABLE `DocumentFields` (
  `FieldID` int(20) NOT NULL auto_increment,
  `DocID` int(20) default '0',
  `Name` varchar(64) default NULL,
  `LangId` int(20) NOT NULL default '1',
  `FieldValue` text,
  PRIMARY KEY  (`FieldID`),
  UNIQUE KEY `FieldID` (`FieldID`),
  KEY `DocID` (`DocID`),
  KEY `LangCode` (`LangId`)
) ENGINE=InnoDB; 

CREATE TABLE `DocumentLanguages` (
  `dlId` int(20) NOT NULL auto_increment,
  `DocId` int(20) default '0',
  `LangId` int(20) default '0',
  `DocName` varchar(50) default NULL,
  `LangStatus` int(20) default '0',
  `LangModuleURL` varchar(150) default NULL,
  PRIMARY KEY  (`dlId`),
  KEY `dlId` (`dlId`),
  KEY `DocId` (`DocId`),
  KEY `LangId` (`LangId`)
) ENGINE=InnoDB; 

CREATE TABLE `Documents` (
  `DocumentID` int(20) NOT NULL auto_increment,
  `ParentID` int(20) default '0',
  `prevDocumentID` int(20) default '0',
  `prevParentID` int(20) default '0',
  `SortOrder` int(20) default '0',
  `isFolder` int(20) default '0',
  `DocName` varchar(64) default NULL,
  `ModuleID` int(20) default '0',
  `ModuleFrame` varchar(100) default NULL,
  `TemplateURL` varchar(255) default NULL,
  `CreatedBy` int(20) default '0',
  `CreatedDate` datetime default NULL,
  `ModifiedBy` int(20) default '0',
  `ModifiedDate` datetime default NULL,
  `SentForApprovalDate` datetime default NULL,
  `PublishDate` datetime default NULL,
  `ExpiresDate` datetime default NULL,
  `Active` int(20) default '0',
  `ApprovalID` int(20) default '0',
  `DocumentStatus` int(11) default '0',
  `SecLevel` int(11) default '0',
  `ExternalPage` int(11) default '0',
  `ExternalPageURL` varchar(250) default NULL,
  `ExternalPageFrame` varchar(50) default NULL,
  `Extra1` varchar(25) default NULL,
  `Extra2` varchar(25) default NULL,
  `Extra3` varchar(25) default NULL,
  `MultiPageStartYN` varchar(50) default NULL,
  `MultiPagePrevPage` int(11) default '0',
  `MultiPageNextPage` int(20) default '0',
  `TreeIcon` varchar(25) default NULL,
  `Searchable` int(11) default '1',
  PRIMARY KEY  (`DocumentID`),
  UNIQUE KEY `DocumentID` (`DocumentID`),
  KEY `ApprovalID` (`ApprovalID`),
  KEY `CreatedBy` (`CreatedBy`),
  KEY `ModuleID` (`ModuleID`),
  KEY `ParentID` (`ParentID`),
  KEY `prevDocumentID` (`prevDocumentID`),
  KEY `prevParentID` (`prevParentID`),
  KEY `SortOrder` (`SortOrder`)
) ENGINE=InnoDB; 

CREATE TABLE `FunctionScripts` (
  `ID` int(20) NOT NULL auto_increment,
  `Name` varchar(50) default NULL,
  `Code` text,
  PRIMARY KEY  (`ID`),
  KEY `Name` (`Name`)
) ENGINE=InnoDB; 

CREATE TABLE `Languages` (
  `ID` int(20) NOT NULL auto_increment,
  `Code` varchar(3) default NULL,
  `Description` varchar(50) default NULL,
  `MasterLanguage` int(20) default '0',
  `LCID` int(20) default '0',
  `Charset` varchar(20) default NULL,
  `LanguageImage` varchar(150) default NULL,
  `IsMenuDirty` int(20) default '0',
  `SiteTitle` varchar(250) default NULL,
  `ShowFlag` int(11) default '0',
  PRIMARY KEY  (`ID`),
  KEY `Code` (`Code`),
  KEY `Id` (`ID`),
  KEY `LCID` (`LCID`)
) ENGINE=InnoDB; 

CREATE TABLE `Members` (
  `ID` int(20) NOT NULL auto_increment,
  `Email` varchar(100) default NULL,
  `MemberPassword` varchar(15) default NULL,
  `Nickname` varchar(50) default NULL,
  `MemberLevel` int(20) default '1',
  `Status` int(20) default '1',
  `Registred` datetime default NULL,
  `LastLoggin` datetime default NULL,
  `LoginCount` int(20) default '0',
  `Firstname` varchar(75) default NULL,
  `LastName` varchar(100) default NULL,
  `Company` varchar(100) default NULL,
  `JobTitle` varchar(50) default NULL,
  `Phone` varchar(50) default NULL,
  `Street1` varchar(75) default NULL,
  `Street2` varchar(75) default NULL,
  `City` varchar(100) default NULL,
  `State` varchar(2) default NULL,
  `ZipCode` varchar(10) default NULL,
  `Country` varchar(2) default NULL,
  `MembershipEnds` datetime default NULL,
  `NewsLetter` int(20) default '0',
  `Code1` varchar(10) default NULL,
  `Code2` varchar(10) default NULL,
  `Code3` varchar(10) default NULL,
  `Code4` varchar(10) default NULL,
  `Code5` varchar(10) default NULL,
  PRIMARY KEY  (`ID`),
  KEY `Code1` (`Code1`),
  KEY `Code2` (`Code2`),
  KEY `Code3` (`Code3`),
  KEY `Code4` (`Code4`),
  KEY `Code5` (`Code5`),
  KEY `ID` (`ID`),
  KEY `ZipCode` (`ZipCode`)
) ENGINE=InnoDB; 

CREATE TABLE `Modules` (
  `ModuleID` int(20) NOT NULL auto_increment,
  `ModuleName` varchar(50) default NULL,
  `ModuleVersion` varchar(5) default NULL,
  `StartURL` varchar(200) default NULL,
  `StartFrame` varchar(50) default NULL,
  `AdminURL` varchar(200) default NULL,
  `Active` int(11) default '0',
  PRIMARY KEY  (`ModuleID`),
  KEY `ModuleID` (`ModuleID`)
) ENGINE=InnoDB; 

CREATE TABLE `SystemData` (
  `sdID` int(20) NOT NULL auto_increment,
  `OwnerCompany` varchar(100) default NULL,
  `OwnerName` varchar(100) default NULL,
  `OwnerEmail` varchar(100) default NULL,
  `OwnerSiteID` varchar(10) default NULL,
  `VersionType` varchar(255) default NULL,
  `VersionNumber` varchar(10) default NULL,
  `VersionBuild` varchar(10) default NULL,
  `DealerID` varchar(10) default NULL,
  `HostingID` varchar(50) default NULL,
  `swoAccountID` varchar(15) default NULL,
  `swoURL` varchar(150) default NULL,
  `swoLoggin` varchar(20) default NULL,
  `swoPassword` varchar(20) default NULL,
  PRIMARY KEY  (`sdID`),
  KEY `sdID` (`sdID`)
) ENGINE=InnoDB; 

CREATE TABLE `Tasks` (
  `ID` int(20) NOT NULL auto_increment,
  `OwnerID` int(20) default '0',
  `OwnerGroupID` int(20) default '0',
  `CreatedByID` int(20) default '0',
  `DocumentID` int(20) default '0',
  `RevisionID` int(20) default '0',
  `Prio` int(20) default '0',
  `Status` int(20) default '0',
  `Subject` varchar(50) default NULL,
  `DueDate` datetime default NULL,
  `Description` varchar(200) default NULL,
  PRIMARY KEY  (`ID`),
  KEY `CreatedByID` (`CreatedByID`),
  KEY `DocumentID` (`DocumentID`),
  KEY `ID` (`ID`),
  KEY `OwnerGroupID` (`OwnerGroupID`),
  KEY `OwnerID` (`OwnerID`),
  KEY `RevisionID` (`RevisionID`)
) ENGINE=InnoDB; 

CREATE TABLE `UserGroups` (
  `ID` int(20) NOT NULL auto_increment,
  `Description` varchar(50) default NULL,
  `vRead` int(11) default '0',
  `vCreate` int(11) default '0',
  `vEdit` int(11) default '0',
  `vDelete` int(11) default '0',
  PRIMARY KEY  (`ID`),
  KEY `ID` (`ID`)
) ENGINE=InnoDB; 

CREATE TABLE `Users` (
  `UserID` int(20) NOT NULL auto_increment,
  `FirstName` varchar(50) default NULL,
  `LastName` varchar(50) default NULL,
  `LoginName` varchar(50) default NULL,
  `LoginPassword` varchar(50) default NULL,
  `Email` varchar(50) default NULL,
  `Expires` datetime default NULL,
  `UserType` int(20) default '0',
  `Address1` varchar(50) default NULL,
  `Address2` varchar(50) default NULL,
  `Address3` varchar(50) default NULL,
  `Department` varchar(30) default NULL,
  `Phone` varchar(50) default NULL,
  `ntName` varchar(80) default NULL,
  `EmailApprovalInfoYN` int(20) default '0',
  `UserGroup` int(20) default '0',
  `isPublisher` int(11) default '0',
  `EditorWidth` int(20) default '0',
  `EditorWidthType` int(20) default '0',
  `EditorHeight` int(20) default '0',
  `EditorHeightType` int(20) default '0',
  PRIMARY KEY  (`UserID`),
  KEY `LastName` (`LastName`),
  KEY `LoginName` (`LoginName`),
  KEY `LoginPassword` (`LoginPassword`)
) ENGINE=InnoDB; 

CREATE TABLE `WorkFlowInfo` (
  `ID` int(20) NOT NULL auto_increment,
  `DocID` int(20) default '0',
  `UserID` int(20) default '0',
  `LangID` int(20) default '0',
  `ApprovalUserID` int(20) default '0',
  `Status` int(20) default '0',
  `Info` varchar(254) default NULL,
  PRIMARY KEY  (`ID`),
  KEY `ApprovalUserID` (`ApprovalUserID`),
  KEY `DocID` (`DocID`),
  KEY `ID` (`ID`),
  KEY `LangID` (`LangID`),
  KEY `UserID` (`UserID`)
) ENGINE=InnoDB; 

