00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 $installer = $this;
00028
00029
00030 $installer->startSetup();
00031
00032 $installer->run("
00033
00034 /*Table structure for table `newsletter_problem` */
00035
00036 -- DROP TABLE IF EXISTS {$this->getTable('newsletter_problem')};
00037 CREATE TABLE {$this->getTable('newsletter_problem')} (
00038 `problem_id` int(7) unsigned NOT NULL auto_increment,
00039 `subscriber_id` int(7) unsigned default NULL,
00040 `queue_id` int(7) unsigned NOT NULL default '0',
00041 `problem_error_code` int(3) unsigned default '0',
00042 `problem_error_text` varchar(200) default NULL,
00043 PRIMARY KEY (`problem_id`),
00044 KEY `FK_PROBLEM_SUBSCRIBER` (`subscriber_id`),
00045 KEY `FK_PROBLEM_QUEUE` (`queue_id`),
00046 CONSTRAINT `FK_PROBLEM_QUEUE` FOREIGN KEY (`queue_id`) REFERENCES {$this->getTable('newsletter_queue')} (`queue_id`),
00047 CONSTRAINT `FK_PROBLEM_SUBSCRIBER` FOREIGN KEY (`subscriber_id`) REFERENCES {$this->getTable('newsletter_subscriber')} (`subscriber_id`)
00048 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Newsletter problems';
00049
00050 /*Data for the table `newsletter_problem` */
00051
00052 /*Table structure for table `newsletter_queue` */
00053
00054 -- DROP TABLE IF EXISTS {$this->getTable('newsletter_queue')};
00055 CREATE TABLE {$this->getTable('newsletter_queue')} (
00056 `queue_id` int(7) unsigned NOT NULL auto_increment,
00057 `template_id` int(7) unsigned NOT NULL default '0',
00058 `queue_status` int(3) unsigned NOT NULL default '0',
00059 `queue_start_at` datetime default NULL,
00060 `queue_finish_at` datetime default NULL,
00061 PRIMARY KEY (`queue_id`),
00062 KEY `FK_QUEUE_TEMPLATE` (`template_id`),
00063 CONSTRAINT `FK_QUEUE_TEMPLATE` FOREIGN KEY (`template_id`) REFERENCES {$this->getTable('newsletter_template')} (`template_id`) ON DELETE CASCADE
00064 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Newsletter queue';
00065
00066 /*Data for the table `newsletter_queue` */
00067
00068 /*Table structure for table `newsletter_queue_link` */
00069
00070 -- DROP TABLE IF EXISTS {$this->getTable('newsletter_queue_link')};
00071 CREATE TABLE {$this->getTable('newsletter_queue_link')} (
00072 `queue_link_id` int(9) unsigned NOT NULL auto_increment,
00073 `queue_id` int(7) unsigned NOT NULL default '0',
00074 `subscriber_id` int(7) unsigned NOT NULL default '0',
00075 `letter_sent_at` datetime default NULL,
00076 PRIMARY KEY (`queue_link_id`),
00077 KEY `FK_QUEUE_LINK_SUBSCRIBER` (`subscriber_id`),
00078 KEY `FK_QUEUE_LINK_QUEUE` (`queue_id`),
00079 CONSTRAINT `FK_QUEUE_LINK_QUEUE` FOREIGN KEY (`queue_id`) REFERENCES {$this->getTable('newsletter_queue')} (`queue_id`) ON DELETE CASCADE,
00080 CONSTRAINT `FK_QUEUE_LINK_SUBSCRIBER` FOREIGN KEY (`subscriber_id`) REFERENCES {$this->getTable('newsletter_subscriber')} (`subscriber_id`) ON DELETE CASCADE
00081 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Newsletter queue to subscriber link';
00082
00083 /*Data for the table `newsletter_queue_link` */
00084
00085 /*Table structure for table `newsletter_queue_store_link` */
00086
00087 -- DROP TABLE IF EXISTS {$this->getTable('newsletter_queue_store_link')};
00088 CREATE TABLE {$this->getTable('newsletter_queue_store_link')} (
00089 `queue_id` int(7) unsigned NOT NULL default '0',
00090 `store_id` smallint(5) unsigned NOT NULL default '0',
00091 PRIMARY KEY (`queue_id`,`store_id`),
00092 CONSTRAINT `FK_LINK_QUEUE` FOREIGN KEY (`queue_id`) REFERENCES {$this->getTable('newsletter_queue')} (`queue_id`) ON DELETE CASCADE
00093 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00094
00095 /*Data for the table `newsletter_queue_store_link` */
00096
00097 /*Table structure for table `newsletter_subscriber` */
00098
00099 -- DROP TABLE IF EXISTS {$this->getTable('newsletter_subscriber')};
00100 CREATE TABLE {$this->getTable('newsletter_subscriber')} (
00101 `subscriber_id` int(7) unsigned NOT NULL auto_increment,
00102 `store_id` int(3) unsigned default '0',
00103 `change_status_at` datetime default NULL,
00104 `customer_id` int(11) unsigned NOT NULL default '0',
00105 `subscriber_email` varchar(150) character set latin1 collate latin1_general_ci NOT NULL default '',
00106 `subscriber_status` int(3) NOT NULL default '0',
00107 `subscriber_confirm_code` varchar(32) default 'NULL',
00108 PRIMARY KEY (`subscriber_id`),
00109 KEY `FK_SUBSCRIBER_STORE` (`store_id`),
00110 KEY `FK_SUBSCRIBER_CUSTOMER` (`customer_id`)
00111 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Newsletter subscribers';
00112
00113 /*Data for the table `newsletter_subscriber` */
00114
00115 /*Table structure for table `newsletter_template` */
00116
00117 -- DROP TABLE IF EXISTS {$this->getTable('newsletter_template')};
00118 CREATE TABLE {$this->getTable('newsletter_template')} (
00119 `template_id` int(7) unsigned NOT NULL auto_increment,
00120 `template_code` varchar(150) default NULL,
00121 `template_text` text,
00122 `template_text_preprocessed` text,
00123 `template_type` int(3) unsigned default NULL,
00124 `template_subject` varchar(200) default NULL,
00125 `template_sender_name` varchar(200) default NULL,
00126 `template_sender_email` varchar(200) character set latin1 collate latin1_general_ci default NULL,
00127 `template_actual` tinyint(1) unsigned default '1',
00128 `added_at` datetime default NULL,
00129 `modified_at` datetime default NULL,
00130 PRIMARY KEY (`template_id`),
00131 KEY `template_actual` (`template_actual`),
00132 KEY `added_at` (`added_at`),
00133 KEY `modified_at` (`modified_at`)
00134 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Newsletter templates';
00135
00136 /*Data for the table `newsletter_template` */
00137
00138 insert into {$this->getTable('newsletter_template')}(`template_id`,`template_code`,`template_text`,`template_text_preprocessed`,`template_type`,`template_subject`,`template_sender_name`,`template_sender_email`,`template_actual`,`added_at`,`modified_at`) values (1,'Great Newsletter','This is a GREAT <br> <br> Newsletter','This is a GREAT <br> <br> Newsletter',2,'Greatness','Magento','david@varien.com',0,'2007-08-29 17:30:31','2007-08-29 17:30:31'),(2,'Great Newsletter','This is a GREAT <br> <br> Newsletter','This is a GREAT <br> <br> Newsletter',2,'Greatness','Magento','david@varien.com',0,'2007-08-29 17:30:31','2007-08-29 17:30:31'),(3,'Great Newsletter','This is a GREAT <br> <br> Newsletter',NULL,2,'Greatness','Magento','david@varien.com',1,'2007-08-29 17:30:31','2007-08-29 17:30:31');
00139 ");
00140
00141 $installer->endSetup();