
CREATE TABLE Posting (
  PostingId int(11) NOT NULL auto_increment,
  IPAddress varchar(255) NOT NULL default '',
  PosterAlias varchar(255) NOT NULL default '',
  Pending tinyint(4) NOT NULL default '0',
  Subject varchar(255) default NULL,
  PostingText text,
  GraphicsUrl varchar(255) default NULL,
  CreatedOn int(11) NOT NULL default '0',
  Modified int(11) NOT NULL default '0',
  ModifiedById int(11) default NULL,
  CreatedById int(11) default NULL,
  TopicId int(11) NOT NULL default '0',
  ResourceId int(11) NOT NULL default '0',
  ReplyTo int(11) NOT NULL default '0',
  Options int(11) NOT NULL default '0',
  PRIMARY KEY  (PostingId),
  KEY TopicId (TopicId),
  KEY Pending (Pending),
  KEY CreatedById (CreatedById),
  KEY CreatedOn (CreatedOn),
  KEY ModifiedOn (Modified),
  KEY ModifiedById (ModifiedById)
)
# --------------------------------------------------------
CREATE TABLE Topic (
  TopicId int(11) NOT NULL auto_increment,
  NotifyOwnerOnChanges tinyint(4) NOT NULL default '0',
  Modified int(11) NOT NULL default '0',
  TopicText varchar(255) NOT NULL default '',
  AutomaticFilename tinyint(3) unsigned NOT NULL default '1',
  Posts int(11) NOT NULL default '0',
  Views double(20,6) NOT NULL default '0',
  EditorsPick tinyint(4) NOT NULL default '0',
  Status tinyint(4) unsigned NOT NULL default '2',
  Priority int(11) NOT NULL default '0',
  OwnerId int(11) NOT NULL default '-1',
  ModifiedById int(11) NOT NULL default '0',
  ResourceId int(11) default NULL,
  TopicType int(11) NOT NULL default '1',
  CreatedOn int(11) NOT NULL default '0',
  CachedReviewsQty int(11) NOT NULL default '0',
  CachedRating VARCHAR(10) NOT NULL DEFAULT '0',
  CachedVotesQty int(11) NOT NULL default '0',
  NewItem tinyint(4) NOT NULL default '2',
  PopItem tinyint(4) NOT NULL default '2',
  HotItem tinyint(4) NOT NULL default '2',
  PostedBy varchar(255) NOT NULL default '',
  OrgId INT(11) NULL DEFAULT NULL,
  LastPostId int(11) NOT NULL default '0',
  LastPostDate INT(11) NULL DEFAULT NULL,
  TodayDate DATE NULL DEFAULT NULL,
  TodayPosts int(11) NOT NULL default '0',
  PRIMARY KEY  (TopicId),
  KEY OwnerId (OwnerId),
  UNIQUE KEY ResourceId (ResourceId),
  KEY ModifiedById (ModifiedById),
  KEY Posts (Posts),
  KEY Modified (Modified)
)
# --------------------------------------------------------
CREATE TABLE Censorship (
  CensorshipId int(11) NOT NULL auto_increment,
  BadWord varchar(80) NOT NULL default '',
  Replacement varchar(80) NOT NULL default '',
  PRIMARY KEY  (CensorshipId)
) 
# --------------------------------------------------------
CREATE TABLE Emoticon (
  EmoticonId int(11) NOT NULL auto_increment,
  Name varchar(20) NOT NULL default '',
  ImageId int(11) NOT NULL default '0',
  KeyStroke varchar(20) NOT NULL default '',
  Enabled int(11) NOT NULL default '1',
  PRIMARY KEY  (EmoticonId)
) 
# --------------------------------------------------------
CREATE TABLE PrivateMessageBody (
  PMBodyId int(11) unsigned NOT NULL auto_increment,
  Subject varchar(255) NOT NULL default '',
  Body text NOT NULL,
  Options tinyint(3) unsigned NOT NULL default '0',
  ReferenceCount smallint(5) unsigned NOT NULL default '0',
  PRIMARY KEY  (PMBodyId)
)
# --------------------------------------------------------
CREATE TABLE PrivateMessages (
  PmId int(11) unsigned NOT NULL auto_increment,
  FromId int(11) unsigned NOT NULL default '0',
  ToId int(11) unsigned NOT NULL default '0',
  FolderId TINYINT(3) NOT NULL DEFAULT '-1',
  Status tinyint(1) unsigned NOT NULL default '0',
  PMBodyId int(11) unsigned NOT NULL default '0',
  CreatedOn int(11) unsigned NOT NULL default '0',
  PRIMARY KEY  (PmId),
  KEY FromId (FromId),
  KEY CreatedOn (CreatedOn),
  KEY ToId (ToId)
)
# --------------------------------------------------------
CREATE TABLE TopicCustomData (
  CustomDataId int(11) NOT NULL auto_increment,
  ResourceId int(10) unsigned NOT NULL default '0',
  KEY ResourceId (ResourceId),
  PRIMARY KEY  (CustomDataId)
)
# --------------------------------------------------------