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 -- DROP TABLE IF EXISTS {$this->getTable('core_config_data')};
00035 CREATE TABLE {$this->getTable('core_config_data')} (
00036 `config_id` int(10) unsigned NOT NULL auto_increment,
00037 `scope` enum('default','websites','stores','config') NOT NULL default 'default',
00038 `scope_id` int(11) NOT NULL default '0',
00039 `path` varchar(255) NOT NULL default 'general',
00040 `value` text NOT NULL,
00041 PRIMARY KEY (`config_id`),
00042 UNIQUE KEY `config_scope` (`scope`,`scope_id`,`path`)
00043 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00044
00045 -- DROP TABLE IF EXISTS {$this->getTable('core_email_template')};
00046 CREATE TABLE {$this->getTable('core_email_template')} (
00047 `template_id` int(7) unsigned NOT NULL auto_increment,
00048 `template_code` varchar(150) default NULL,
00049 `template_text` text,
00050 `template_type` int(3) unsigned default NULL,
00051 `template_subject` varchar(200) default NULL,
00052 `template_sender_name` varchar(200) default NULL,
00053 `template_sender_email` varchar(200) character set latin1 collate latin1_general_ci default NULL,
00054 `added_at` datetime default NULL,
00055 `modified_at` datetime default NULL,
00056 PRIMARY KEY (`template_id`),
00057 UNIQUE KEY `template_code` (`template_code`),
00058 KEY `added_at` (`added_at`),
00059 KEY `modified_at` (`modified_at`)
00060 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Email templates';
00061
00062 -- DROP TABLE IF EXISTS {$this->getTable('core_language')};
00063 CREATE TABLE {$this->getTable('core_language')} (
00064 `language_code` varchar(2) NOT NULL default '',
00065 `language_title` varchar(32) NOT NULL default '',
00066 PRIMARY KEY (`language_code`)
00067 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Languages';
00068
00069 insert into {$this->getTable('core_language')}(`language_code`,`language_title`) values ('aa','Afar'),('ab','Abkhazian'),('af','Afrikaans'),('am','Amharic'),('ar','Arabic'),('as','Assamese'),('ay','Aymara'),('az','Azerbaijani'),('ba','Bashkir'),('be','Byelorussian'),('bg','Bulgarian'),('bh','Bihari'),('bi','Bislama'),('bn','Bengali'),('bo','Tibetan'),('br','Breton'),('ca','Catalan'),('co','Corsican'),('cs','Czech'),('cy','Welsh'),('da','Danish'),('de','German'),('dz','Bhutani'),('el','Greek'),('en','English'),('eo','Esperanto'),('es','Spanish'),('et','Estonian'),('eu','Basque'),('fa','Persian'),('fi','Finnish'),('fj','Fiji'),('fo','Faeroese'),('fr','French'),('fy','Frisian'),('ga','Irish'),('gd','Gaelic'),('gl','Galician'),('gn','Guarani'),('gu','Gujarati'),('ha','Hausa'),('hi','Hindi'),('hr','Croatian'),('hu','Hungarian'),('hy','Armenian'),('ia','Interlingua'),('ie','Interlingue'),('ik','Inupiak'),('in','Indonesian'),('is','Icelandic'),('it','Italian'),('iw','Hebrew'),('ja','Japanese'),('ji','Yiddish'),('jw','Javanese'),('ka','Georgian'),('kk','Kazakh'),('kl','Greenlandic'),('km','Cambodian'),('kn','Kannada'),('ko','Korean'),('ks','Kashmiri'),('ku','Kurdish'),('ky','Kirghiz'),('la','Latin'),('ln','Lingala'),('lo','Laothian'),('lt','Lithuanian'),('lv','Latvian'),('mg','Malagasy'),('mi','Maori'),('mk','Macedonian'),('ml','Malayalam'),('mn','Mongolian'),('mo','Moldavian'),('mr','Marathi'),('ms','Malay'),('mt','Maltese'),('my','Burmese'),('na','Nauru'),('ne','Nepali'),('nl','Dutch'),('no','Norwegian'),('oc','Occitan'),('om','Oromo'),('or','Oriya'),('pa','Punjabi'),('pl','Polish'),('ps','Pashto'),('pt','Portuguese'),('qu','Quechua'),('rm','Rhaeto-Romance'),('rn','Kirundi'),('ro','Romanian'),('ru','Russian'),('rw','Kinyarwanda'),('sa','Sanskrit'),('sd','Sindhi'),('sg','Sangro'),('sh','Serbo-Croatian'),('si','Singhalese'),('sk','Slovak'),('sl','Slovenian'),('sm','Samoan'),('sn','Shona'),('so','Somali'),('sq','Albanian'),('sr','Serbian'),('ss','Siswati'),('st','Sesotho'),('su','Sudanese'),('sv','Swahili'),('sw','Swedish'),('ta','Tamil'),('te','Tegulu'),('tg','Tajik'),('th','Thai'),('ti','Tigrinya'),('tk','Turkmen'),('tl','Tagalog'),('tn','Setswana'),('to','Tonga'),('tr','Turkish'),('ts','Tsonga'),('tt','Tatar'),('tw','Twi'),('uk','Ukrainian'),('ur','Urdu'),('uz','Uzbek'),('vi','Vietnamese'),('vo','Volapuk'),('wo','Wolof'),('xh','Xhosa'),('yo','Yoruba'),('zh','Chinese'),('zu','Zulu');
00070
00071 -- DROP TABLE IF EXISTS {$this->getTable('core_resource')};
00072 CREATE TABLE {$this->getTable('core_resource')} (
00073 `code` varchar(50) NOT NULL default '',
00074 `version` varchar(50) NOT NULL default '',
00075 PRIMARY KEY (`code`)
00076 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Resource version registry';
00077
00078 -- DROP TABLE IF EXISTS {$this->getTable('core_session')};
00079 CREATE TABLE {$this->getTable('core_session')} (
00080 `session_id` varchar(255) NOT NULL default '',
00081 `website_id` smallint(5) unsigned default NULL,
00082 `session_expires` int(10) unsigned NOT NULL default '0',
00083 `session_data` text NOT NULL,
00084 PRIMARY KEY (`session_id`),
00085 KEY `FK_SESSION_WEBSITE` (`website_id`),
00086 CONSTRAINT `FK_SESSION_WEBSITE` FOREIGN KEY (`website_id`) REFERENCES {$this->getTable('core_website')} (`website_id`) ON DELETE CASCADE ON UPDATE CASCADE
00087 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Session data store';
00088
00089 -- DROP TABLE IF EXISTS {$this->getTable('core_store')};
00090 CREATE TABLE {$this->getTable('core_store')} (
00091 `store_id` smallint(5) unsigned NOT NULL auto_increment,
00092 `code` varchar(32) NOT NULL default '',
00093 `language_code` varchar(2) default NULL,
00094 `website_id` smallint(5) unsigned default '0',
00095 `name` varchar(32) NOT NULL default '',
00096 `sort_order` smallint(5) unsigned NOT NULL default '0',
00097 `is_active` tinyint(1) unsigned NOT NULL default '0',
00098 PRIMARY KEY (`store_id`),
00099 UNIQUE KEY `code` (`code`),
00100 KEY `FK_STORE_LANGUAGE` (`language_code`),
00101 KEY `FK_STORE_WEBSITE` (`website_id`),
00102 KEY `is_active` (`is_active`,`sort_order`),
00103 CONSTRAINT `FK_STORE_LANGUAGE` FOREIGN KEY (`language_code`) REFERENCES {$this->getTable('core_language')} (`language_code`) ON DELETE SET NULL ON UPDATE SET NULL,
00104 CONSTRAINT `FK_STORE_WEBSITE` FOREIGN KEY (`website_id`) REFERENCES {$this->getTable('core_website')} (`website_id`) ON DELETE SET NULL ON UPDATE SET NULL
00105 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Stores';
00106
00107 insert into {$this->getTable('core_store')}(`store_id`,`code`,`language_code`,`website_id`,`name`,`sort_order`,`is_active`) values (0,'default','en',0,'Default',0,1),(1,'base','en',1,'English',0,1);
00108
00109 -- DROP TABLE IF EXISTS {$this->getTable('core_translate')};
00110 CREATE TABLE {$this->getTable('core_translate')} (
00111 `key_id` int(10) unsigned NOT NULL auto_increment,
00112 `string` varchar(255) NOT NULL default '',
00113 `store_id` smallint(5) unsigned NOT NULL default '0',
00114 `translate` varchar(255) NOT NULL default '',
00115 PRIMARY KEY (`key_id`),
00116 UNIQUE KEY `IDX_CODE` (`string`,`store_id`),
00117 KEY `FK_CORE_TRANSLATE_STORE` (`store_id`),
00118 CONSTRAINT `FK_CORE_TRANSLATE_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00119 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Translation data';
00120
00121
00122 -- DROP TABLE IF EXISTS {$this->getTable('core_website')};
00123 CREATE TABLE {$this->getTable('core_website')} (
00124 `website_id` smallint(5) unsigned NOT NULL auto_increment,
00125 `code` varchar(32) NOT NULL default '',
00126 `name` varchar(64) NOT NULL default '',
00127 `sort_order` smallint(5) unsigned NOT NULL default '0',
00128 `is_active` tinyint(1) unsigned NOT NULL default '0',
00129 PRIMARY KEY (`website_id`),
00130 UNIQUE KEY `code` (`code`),
00131 KEY `is_active` (`is_active`,`sort_order`)
00132 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Websites';
00133
00134 insert into {$this->getTable('core_website')}(`website_id`,`code`,`name`,`sort_order`,`is_active`) values (0,'default','Default',0,1),(1,'base','Main Website',0,1);
00135
00136 -- DROP TABLE IF EXISTS {$this->getTable('core_layout_update')};
00137 CREATE TABLE {$this->getTable('core_layout_update')} (
00138 `layout_update_id` int(10) unsigned NOT NULL auto_increment,
00139 `handle` varchar(255) default NULL,
00140 `xml` text,
00141 PRIMARY KEY (`layout_update_id`),
00142 KEY `handle` (`handle`)
00143 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00144
00145 -- DROP TABLE IF EXISTS {$this->getTable('core_layout_link')};
00146 CREATE TABLE {$this->getTable('core_layout_link')} (
00147 `layout_link_id` int(10) unsigned NOT NULL auto_increment,
00148 `store_id` smallint(5) unsigned NOT NULL default '0',
00149 `package` varchar(64) NOT NULL default '',
00150 `theme` varchar(64) NOT NULL default '',
00151 `layout_update_id` int(10) unsigned NOT NULL default '0',
00152 PRIMARY KEY (`layout_link_id`),
00153 UNIQUE KEY `store_id` (`store_id`,`package`,`theme`,`layout_update_id`),
00154 KEY `FK_core_layout_link_update` (`layout_update_id`),
00155 CONSTRAINT `FK_core_layout_link_store` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00156 CONSTRAINT `FK_core_layout_link_update` FOREIGN KEY (`layout_update_id`) REFERENCES {$this->getTable('core_layout_update')} (`layout_update_id`) ON DELETE CASCADE ON UPDATE CASCADE
00157 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00158
00159 -- DROP TABLE if exists {$this->getTable('core_url_rewrite')};
00160 create table {$this->getTable('core_url_rewrite')} (
00161 `url_rewrite_id` int unsigned not null auto_increment primary key,
00162 `store_id` smallint unsigned not null,
00163 `id_path` varchar(255) not null,
00164 `request_path` varchar(255) not null,
00165 `target_path` varchar(255) not null,
00166 `options` varchar(255) not null,
00167 `type` int(1) NOT NULL DEFAULT '0',
00168 `description` varchar(255) NULL,
00169 unique (`id_path`, `store_id`),
00170 unique (`request_path`, `store_id`),
00171 key (`target_path`, `store_id`),
00172 foreign key (`store_id`) references {$this->getTable('core_store')} (`store_id`) on delete cascade on update cascade
00173 ) engine=InnoDB default charset=utf8;
00174
00175 -- DROP TABLE if exists {$this->getTable('core_url_rewrite_tag')};
00176 create table {$this->getTable('core_url_rewrite_tag')} (
00177 `url_rewrite_tag_id` int unsigned not null auto_increment primary key,
00178 `url_rewrite_id` int unsigned not null,
00179 `tag` varchar(255),
00180 unique (`tag`, `url_rewrite_id`),
00181 key (`url_rewrite_id`),
00182 foreign key (`url_rewrite_id`) references {$this->getTable('core_url_rewrite')} (`url_rewrite_id`) on delete cascade on update cascade
00183 ) engine=InnoDB default charset=utf8;
00184
00185 -- DROP TABLE if exists {$this->getTable('design_change')};
00186 CREATE TABLE {$this->getTable('design_change')} (
00187 `design_change_id` INT NOT NULL AUTO_INCREMENT,
00188 `store_id` smallint(5) unsigned NOT NULL ,
00189 `package` VARCHAR( 255 ) NOT NULL ,
00190 `theme` VARCHAR( 255 ) NOT NULL ,
00191 `date_from` DATE NOT NULL ,
00192 `date_to` DATE NOT NULL,
00193 KEY `FK_DESIGN_CHANGE_STORE` (`store_id`),
00194 PRIMARY KEY (`design_change_id`)
00195 ) ENGINE = innodb;
00196
00197 ALTER TABLE {$this->getTable('design_change')}
00198 ADD
00199 CONSTRAINT `FK_DESIGN_CHANGE_STORE`
00200 FOREIGN KEY (`store_id`)
00201 REFERENCES {$this->getTable('core_store')} (`store_id`);
00202 ");
00203
00204 $installer->endSetup();