-- phpMyAdmin SQL Dump
-- version 3.3.7deb5build0.10.10.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Apr 06, 2012 at 06:14 PM
-- Server version: 5.1.61
-- PHP Version: 5.3.3-1ubuntu9.10

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `emailing`
--

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

--
-- Table structure for table `ecd_emailing_draft`
--

CREATE TABLE IF NOT EXISTS `ecd_emailing_draft` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `hierarchy_id` int(11) NOT NULL,
  `data` longtext NOT NULL COMMENT '(DC2Type:array)',
  `updated_at` datetime NOT NULL,
  `user_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_671697295DA0FB8` (`template_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_emailing_order`
--

CREATE TABLE IF NOT EXISTS `ecd_emailing_order` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `draft_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `description` longtext,
  `send_at` datetime NOT NULL,
  `sent_at` datetime DEFAULT NULL,
  `validation_levels` longtext,
  `current_validation_level` varchar(255) DEFAULT NULL,
  `closed_at` datetime DEFAULT NULL,
  `canceled` tinyint(1) NOT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `hierarchy_id` int(11) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_D4439225E2F3C5D1` (`draft_id`),
  KEY `hierarchy_idx` (`hierarchy_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_emailing_order_contact`
--

CREATE TABLE IF NOT EXISTS `ecd_emailing_order_contact` (
  `order_id` int(11) NOT NULL,
  `contact_id` int(11) NOT NULL,
  `token` varchar(255) NOT NULL,
  PRIMARY KEY (`order_id`,`contact_id`),
  KEY `IDX_452AD398D9F6D38` (`order_id`),
  KEY `IDX_452AD39E7A1254A` (`contact_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_emailing_order_mailing_list`
--

CREATE TABLE IF NOT EXISTS `ecd_emailing_order_mailing_list` (
  `order_id` int(11) NOT NULL,
  `mailing_list_id` int(11) NOT NULL,
  PRIMARY KEY (`order_id`,`mailing_list_id`),
  KEY `IDX_787AA5BE8D9F6D38` (`order_id`),
  KEY `IDX_787AA5BE2C7EF3E4` (`mailing_list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_emailing_template`
--

CREATE TABLE IF NOT EXISTS `ecd_emailing_template` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `model_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `workflow_ids` longtext NOT NULL COMMENT '(DC2Type:array)',
  `hierarchy_id` int(11) NOT NULL,
  `tag_ids` longtext NOT NULL COMMENT '(DC2Type:array)',
  `subject` longtext,
  `body` longtext,
  `additional_fields` longtext COMMENT '(DC2Type:array)',
  `is_viewable` tinyint(1) NOT NULL,
  `updated_at` datetime NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_EE9ACBE67975B7E7` (`model_id`),
  KEY `hierarchy_idx` (`hierarchy_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_emailing_template_image`
--

CREATE TABLE IF NOT EXISTS `ecd_emailing_template_image` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `template_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `file` varchar(64) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `IDX_605C35FC5DA0FB8` (`template_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_mailing_list_contact`
--

CREATE TABLE IF NOT EXISTS `ecd_mailing_list_contact` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `unsubscribed_at` datetime DEFAULT NULL,
  `last_message_sent_at` datetime DEFAULT NULL,
  `last_message_opened_at` datetime DEFAULT NULL,
  `created_at` datetime NOT NULL,
  `updated_at` datetime NOT NULL,
  `zipcode` varchar(25) DEFAULT NULL,
  `company` varchar(150) DEFAULT NULL,
  `city` varchar(50) DEFAULT NULL,
  `country` varchar(50) DEFAULT NULL,
  `email` varchar(255) NOT NULL,
  `title` varchar(25) DEFAULT NULL,
  `first_name` varchar(150) DEFAULT NULL,
  `last_name` varchar(150) DEFAULT NULL,
  `address` varchar(500) DEFAULT NULL,
  `workphone` varchar(16) DEFAULT NULL,
  `workfax` varchar(16) DEFAULT NULL,
  `homephone` varchar(16) DEFAULT NULL,
  `homefax` varchar(16) DEFAULT NULL,
  `cellphone` varchar(16) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_mailing_list_contact_mailing_list`
--

CREATE TABLE IF NOT EXISTS `ecd_mailing_list_contact_mailing_list` (
  `contact_id` int(11) NOT NULL,
  `mailing_list_id` int(11) NOT NULL,
  PRIMARY KEY (`contact_id`,`mailing_list_id`),
  KEY `IDX_D0E9941AE7A1254A` (`contact_id`),
  KEY `IDX_D0E9941A2C7EF3E4` (`mailing_list_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_mailing_list_contact_tag`
--

CREATE TABLE IF NOT EXISTS `ecd_mailing_list_contact_tag` (
  `contact_id` int(11) NOT NULL,
  `tag_id` int(11) NOT NULL,
  PRIMARY KEY (`contact_id`,`tag_id`),
  KEY `IDX_E898C0C3E7A1254A` (`contact_id`),
  KEY `IDX_E898C0C3BAD26311` (`tag_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_mailing_list_mailing_list`
--

CREATE TABLE IF NOT EXISTS `ecd_mailing_list_mailing_list` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(255) NOT NULL,
  `owner_id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_mailing_list_tag`
--

CREATE TABLE IF NOT EXISTS `ecd_mailing_list_tag` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `tag` varchar(45) NOT NULL,
  `slug` varchar(45) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_model`
--

CREATE TABLE IF NOT EXISTS `ecd_model` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `root_field_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `UNIQ_3D0F200D3F6A6D56` (`root_field_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

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

--
-- Table structure for table `ecd_model_field`
--

CREATE TABLE IF NOT EXISTS `ecd_model_field` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `parent_id` int(11) DEFAULT NULL,
  `tree_level` int(11) NOT NULL,
  `tree_left` int(11) NOT NULL,
  `tree_right` int(11) NOT NULL,
  `tree_root` int(11) NOT NULL,
  `name` varchar(255) NOT NULL,
  `clean_name` varchar(255) NOT NULL,
  `type` varchar(255) NOT NULL,
  `options` longtext NOT NULL COMMENT '(DC2Type:array)',
  PRIMARY KEY (`id`),
  KEY `IDX_D842F38B727ACA70` (`parent_id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;