CREATE TABLE IF NOT EXISTS `newsletter_clickthrough` (
  `ID` int(11) NOT NULL auto_increment,
  `Newsletter_Message_Sent_ID` int(11) default NULL,
  `Newsletter_Email_Sent_ID` int(11) default NULL,
  `URL` varchar(255) default NULL,
  `Click_Date` datetime default NULL,
  PRIMARY KEY  (`ID`),
  KEY `Newsletter_Message_Sent_ID` (`Newsletter_Message_Sent_ID`,`Newsletter_Email_Sent_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `newsletter_email_sent` (
  `ID` int(11) NOT NULL auto_increment,
  `Newsletter_Message_Sent_ID` int(11) default NULL,
  `Contact_ID` int(255) default NULL,
  `Contact_Name` varchar(255) default NULL,
  `Contact_Email` varchar(255) default NULL,
  `Read_First` datetime default NULL,
  `Read_Last` datetime default NULL,
  `Read_Count` int(11) default NULL,
  `Unsubscribed` tinyint(1) default NULL,
  `Unsubscribed_Date` datetime default NULL,
  `Created` datetime default NULL,
  `Updated` datetime default NULL,
  PRIMARY KEY  (`ID`),
  KEY `Newsletter_Message_Sent_ID` (`Newsletter_Message_Sent_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `newsletter_message` (
  `ID` int(11) NOT NULL auto_increment,
  `Title` varchar(255) default NULL,
  `Subject` varchar(255) default NULL,
  `HTML_Content` text,
  `Content` text,
  `Created` datetime default NULL,
  `Updated` datetime default NULL,
  PRIMARY KEY  (`ID`),
  KEY `Title` (`Title`),
  KEY `Updated` (`Updated`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `newsletter_message_sent` (
  `ID` int(11) NOT NULL auto_increment,
  `Newsletter_Message_ID` int(11) default NULL,
  `Newsletter_Message_Title` varchar(255) default NULL,
  `Date_Sent` datetime default NULL,
  `Created` datetime default NULL,
  `Updated` datetime default NULL,
  PRIMARY KEY  (`ID`),
  KEY `Newsletter_Message_ID` (`Newsletter_Message_ID`,`Newsletter_Message_Title`),
  KEY `Newsletter_Message_Title` (`Newsletter_Message_Title`,`Date_Sent`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `newsletter_queue` (
  `ID` int(11) NOT NULL auto_increment,
  `Customer_ID` int(11) default NULL,
  `Name` varchar(255) default NULL,
  `Email` varchar(255) default NULL,
  `Created` datetime default NULL,
  `Updated` datetime default NULL,
  PRIMARY KEY  (`ID`),
  KEY `Customer_ID` (`Customer_ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `newsletter_template` (
  `ID` int(10) NOT NULL auto_increment,
  `Title` varchar(255) default NULL,
  `HTML_Content` text,
  `Created` datetime default NULL,
  `Updated` datetime default NULL,
  PRIMARY KEY  (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;