--
-- Database: `emailtracking`
--

-- --------------------------------------------------------

--
-- Table structure for table `trackingid`
--

CREATE TABLE IF NOT EXISTS `trackingid` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `email_id` varchar(500) NOT NULL,
  `destination_addr` varchar(200) NOT NULL,
  `source_addr` varchar(200) NOT NULL,
  `subject` varchar(1024) NOT NULL,
  `current_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `generated_id` varchar(32) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;

-- --------------------------------------------------------

--
-- Table structure for table `trackinglog`
--

CREATE TABLE IF NOT EXISTS `trackinglog` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `trackingid_id` int(11) NOT NULL,
  `ip_addr` varchar(100) NOT NULL,
  `referrer` varchar(500) NOT NULL,
  `client` varchar(1024) NOT NULL,
  `tracking_type` varchar(20) NOT NULL,
  `timestamp` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `trackingid_id` (`trackingid_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `trackinglog`
--
ALTER TABLE `trackinglog`
  ADD CONSTRAINT `trackinglog_ibfk_1` FOREIGN KEY (`trackingid_id`) REFERENCES `trackingid` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;