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 if (!$installer->tableExists($installer->getTable('catalog_category_entity'))) {
00033
00034 $installer->run("
00035
00036 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_entity')};
00037 CREATE TABLE {$this->getTable('catalog_category_entity')} (
00038 `entity_id` int(10) unsigned NOT NULL auto_increment,
00039 `entity_type_id` smallint(8) unsigned NOT NULL default '0',
00040 `attribute_set_id` smallint(5) unsigned NOT NULL default '0',
00041 `parent_id` int(10) unsigned NOT NULL default '0',
00042 `store_id` smallint(5) unsigned NOT NULL default '0',
00043 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00044 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00045 `is_active` tinyint(1) unsigned NOT NULL default '1',
00046 PRIMARY KEY (`entity_id`),
00047 KEY `FK_catalog_category_ENTITY_ENTITY_TYPE` (`entity_type_id`),
00048 KEY `FK_catalog_category_ENTITY_STORE` (`store_id`)
00049 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Category Entities';
00050
00051 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_entity_datetime')};
00052 CREATE TABLE {$this->getTable('catalog_category_entity_datetime')} (
00053 `value_id` int(11) NOT NULL auto_increment,
00054 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00055 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00056 `store_id` smallint(5) unsigned NOT NULL default '0',
00057 `entity_id` int(10) unsigned NOT NULL default '0',
00058 `value` datetime NOT NULL default '0000-00-00 00:00:00',
00059 PRIMARY KEY (`value_id`),
00060 UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
00061 KEY `FK_ATTRIBUTE_DATETIME_ENTITY` (`entity_id`),
00062 KEY `FK_CATALOG_CATEGORY_ENTITY_DATETIME_ATTRIBUTE` (`attribute_id`),
00063 KEY `FK_CATALOG_CATEGORY_ENTITY_DATETIME_STORE` (`store_id`),
00064 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DATETIME_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00065 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DATETIME_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_category_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00066 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DATETIME_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00067 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00068
00069 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_entity_decimal')};
00070 CREATE TABLE {$this->getTable('catalog_category_entity_decimal')} (
00071 `value_id` int(11) NOT NULL auto_increment,
00072 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00073 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00074 `store_id` smallint(5) unsigned NOT NULL default '0',
00075 `entity_id` int(10) unsigned NOT NULL default '0',
00076 `value` decimal(12,4) NOT NULL default '0.0000',
00077 PRIMARY KEY (`value_id`),
00078 UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
00079 KEY `FK_ATTRIBUTE_DECIMAL_ENTITY` (`entity_id`),
00080 KEY `FK_CATALOG_CATEGORY_ENTITY_DECIMAL_ATTRIBUTE` (`attribute_id`),
00081 KEY `FK_CATALOG_CATEGORY_ENTITY_DECIMAL_STORE` (`store_id`),
00082 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DECIMAL_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00083 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DECIMAL_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_category_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00084 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_DECIMAL_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00085 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00086
00087 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_entity_int')};
00088 CREATE TABLE {$this->getTable('catalog_category_entity_int')} (
00089 `value_id` int(11) NOT NULL auto_increment,
00090 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00091 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00092 `store_id` smallint(5) unsigned NOT NULL default '0',
00093 `entity_id` int(10) unsigned NOT NULL default '0',
00094 `value` int(11) NOT NULL default '0',
00095 PRIMARY KEY (`value_id`),
00096 UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
00097 KEY `FK_ATTRIBUTE_INT_ENTITY` (`entity_id`),
00098 KEY `FK_CATALOG_CATEGORY_EMTITY_INT_ATTRIBUTE` (`attribute_id`),
00099 KEY `FK_CATALOG_CATEGORY_EMTITY_INT_STORE` (`store_id`),
00100 CONSTRAINT `FK_CATALOG_CATEGORY_EMTITY_INT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00101 CONSTRAINT `FK_CATALOG_CATEGORY_EMTITY_INT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_category_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00102 CONSTRAINT `FK_CATALOG_CATEGORY_EMTITY_INT_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00103 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00104
00105 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_entity_text')};
00106 CREATE TABLE {$this->getTable('catalog_category_entity_text')} (
00107 `value_id` int(11) NOT NULL auto_increment,
00108 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00109 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00110 `store_id` smallint(5) unsigned NOT NULL default '0',
00111 `entity_id` int(10) unsigned NOT NULL default '0',
00112 `value` text NOT NULL,
00113 PRIMARY KEY (`value_id`),
00114 UNIQUE KEY `IDX_BASE` (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
00115 KEY `FK_ATTRIBUTE_TEXT_ENTITY` (`entity_id`),
00116 KEY `FK_CATALOG_CATEGORY_ENTITY_TEXT_ATTRIBUTE` (`attribute_id`),
00117 KEY `FK_CATALOG_CATEGORY_ENTITY_TEXT_STORE` (`store_id`),
00118 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_TEXT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00119 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_TEXT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_category_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00120 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_TEXT_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00121 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00122
00123 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_entity_varchar')};
00124 CREATE TABLE {$this->getTable('catalog_category_entity_varchar')} (
00125 `value_id` int(11) NOT NULL auto_increment,
00126 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00127 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00128 `store_id` smallint(5) unsigned NOT NULL default '0',
00129 `entity_id` int(10) unsigned NOT NULL default '0',
00130 `value` varchar(255) NOT NULL default '',
00131 PRIMARY KEY (`value_id`),
00132 UNIQUE KEY `IDX_BASE` USING BTREE (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
00133 KEY `FK_ATTRIBUTE_VARCHAR_ENTITY` (`entity_id`),
00134 KEY `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_ATTRIBUTE` (`attribute_id`),
00135 KEY `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_STORE` (`store_id`),
00136 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00137 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_category_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00138 CONSTRAINT `FK_CATALOG_CATEGORY_ENTITY_VARCHAR_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00139 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00140
00141 -- DROP TABLE IF EXISTS {$this->getTable('catalog_category_product')};
00142 CREATE TABLE {$this->getTable('catalog_category_product')} (
00143 `category_id` int(10) unsigned NOT NULL default '0',
00144 `product_id` int(10) unsigned NOT NULL default '0',
00145 `position` int(10) unsigned NOT NULL default '0',
00146 KEY `CATALOG_CATEGORY_PRODUCT_CATEGORY` (`category_id`),
00147 KEY `CATALOG_CATEGORY_PRODUCT_PRODUCT` (`product_id`),
00148 CONSTRAINT `CATALOG_CATEGORY_PRODUCT_CATEGORY` FOREIGN KEY (`category_id`) REFERENCES {$this->getTable('catalog_category_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00149 CONSTRAINT `CATALOG_CATEGORY_PRODUCT_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00150 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00151
00152 -- DROP TABLE IF EXISTS {$this->getTable('catalog_compare_item')};
00153 CREATE TABLE {$this->getTable('catalog_compare_item')} (
00154 `catalog_compare_item_id` int(11) unsigned NOT NULL auto_increment,
00155 `visitor_id` int(11) unsigned NOT NULL default '0',
00156 `customer_id` int(11) unsigned default NULL,
00157 `product_id` int(11) unsigned NOT NULL default '0',
00158 PRIMARY KEY (`catalog_compare_item_id`),
00159 KEY `FK_CATALOG_COMPARE_ITEM_CUSTOMER` (`customer_id`),
00160 KEY `FK_CATALOG_COMPARE_ITEM_PRODUCT` (`product_id`),
00161 CONSTRAINT `FK_CATALOG_COMPARE_ITEM_CUSTOMER` FOREIGN KEY (`customer_id`) REFERENCES {$this->getTable('customer_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00162 CONSTRAINT `FK_CATALOG_COMPARE_ITEM_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00163 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00164
00165 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_bundle_option')};
00166 CREATE TABLE {$this->getTable('catalog_product_bundle_option')} (
00167 `option_id` int(10) unsigned NOT NULL auto_increment,
00168 `product_id` int(10) unsigned NOT NULL default '0',
00169 PRIMARY KEY (`option_id`),
00170 KEY `FK_catalog_product_bundle_option` (`product_id`),
00171 CONSTRAINT `FK_catalog_product_bundle_option` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE
00172 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00173
00174 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_bundle_option_link')};
00175 CREATE TABLE {$this->getTable('catalog_product_bundle_option_link')} (
00176 `link_id` int(10) unsigned NOT NULL auto_increment,
00177 `option_id` int(10) unsigned NOT NULL default '0',
00178 `product_id` int(10) unsigned NOT NULL default '0',
00179 `discount` decimal(10,4) unsigned default NULL,
00180 PRIMARY KEY (`link_id`),
00181 KEY `FK_catalog_product_bundle_option_link` (`option_id`),
00182 KEY `FK_catalog_product_bundle_option_link_entity` (`product_id`),
00183 CONSTRAINT `FK_catalog_product_bundle_option_link` FOREIGN KEY (`option_id`) REFERENCES {$this->getTable('catalog_product_bundle_option')} (`option_id`) ON DELETE CASCADE,
00184 CONSTRAINT `FK_catalog_product_bundle_option_link_entity` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE
00185 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00186
00187 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_bundle_option_value')};
00188 CREATE TABLE {$this->getTable('catalog_product_bundle_option_value')} (
00189 `value_id` int(10) unsigned NOT NULL auto_increment,
00190 `store_id` smallint(5) unsigned NOT NULL default '0',
00191 `option_id` int(10) unsigned NOT NULL default '0',
00192 `label` varchar(255) default NULL,
00193 `position` smallint(5) unsigned NOT NULL default '0',
00194 PRIMARY KEY (`value_id`),
00195 KEY `FK_catalog_product_bundle_option_label` (`option_id`),
00196 CONSTRAINT `FK_catalog_product_bundle_option_label` FOREIGN KEY (`option_id`) REFERENCES {$this->getTable('catalog_product_bundle_option')} (`option_id`) ON DELETE CASCADE
00197 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00198
00199 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity')};
00200 CREATE TABLE {$this->getTable('catalog_product_entity')} (
00201 `entity_id` int(10) unsigned NOT NULL auto_increment,
00202 `entity_type_id` smallint(8) unsigned NOT NULL default '0',
00203 `attribute_set_id` smallint(5) unsigned NOT NULL default '0',
00204 `parent_id` int(10) unsigned NOT NULL default '0',
00205 `store_id` smallint(5) unsigned NOT NULL default '0',
00206 `type_id` tinyint(3) unsigned NOT NULL default '1',
00207 `sku` varchar (64) default NULL,
00208 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00209 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00210 `is_active` tinyint(1) unsigned NOT NULL default '1',
00211 PRIMARY KEY (`entity_id`),
00212 KEY `FK_CATALOG_PRODUCT_ENTITY_ENTITY_TYPE` (`entity_type_id`),
00213 KEY `FK_CATALOG_PRODUCT_ENTITY_ATTRIBUTE_SET_ID` (`attribute_set_id`),
00214 KEY `FK_CATALOG_PRODUCT_ENTITY_STORE_ID` (`store_id`),
00215 KEY `sku` (`sku`),
00216 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_ATTRIBUTE_SET_ID` FOREIGN KEY (`attribute_set_id`) REFERENCES {$this->getTable('eav_attribute_set')} (`attribute_set_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00217 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES {$this->getTable('eav_entity_type')} (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00218 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00219 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Product Entities';
00220
00221 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_datetime')};
00222 CREATE TABLE {$this->getTable('catalog_product_entity_datetime')} (
00223 `value_id` int(11) NOT NULL auto_increment,
00224 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00225 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00226 `store_id` smallint(5) unsigned NOT NULL default '0',
00227 `entity_id` int(10) unsigned NOT NULL default '0',
00228 `value` datetime NOT NULL default '0000-00-00 00:00:00',
00229 PRIMARY KEY (`value_id`),
00230 KEY `FK_CATALOG_PRODUCT_ENTITY_DATETIME_ATTRIBUTE` (`attribute_id`),
00231 KEY `FK_CATALOG_PRODUCT_ENTITY_DATETIME_STORE` (`store_id`),
00232 KEY `FK_CATALOG_PRODUCT_ENTITY_DATETIME_PRODUCT_ENTITY` (`entity_id`),
00233 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_DATETIME_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00234 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_DATETIME_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00235 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_DATETIME_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00236 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00237
00238 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_decimal')};
00239 CREATE TABLE {$this->getTable('catalog_product_entity_decimal')} (
00240 `value_id` int(11) NOT NULL auto_increment,
00241 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00242 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00243 `store_id` smallint(5) unsigned NOT NULL default '0',
00244 `entity_id` int(10) unsigned NOT NULL default '0',
00245 `value` decimal(12,4) NOT NULL default '0.0000',
00246 PRIMARY KEY (`value_id`),
00247 KEY `FK_CATALOG_PRODUCT_ENTITY_DECIMAL_STORE` (`store_id`),
00248 KEY `FK_CATALOG_PRODUCT_ENTITY_DECIMAL_PRODUCT_ENTITY` (`entity_id`),
00249 KEY `FK_CATALOG_PRODUCT_ENTITY_DECIMAL_ATTRIBUTE` (`attribute_id`),
00250 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_DECIMAL_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00251 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_DECIMAL_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00252 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_DECIMAL_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00253 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00254
00255 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_gallery')};
00256 CREATE TABLE {$this->getTable('catalog_product_entity_gallery')} (
00257 `value_id` int(11) NOT NULL auto_increment,
00258 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00259 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00260 `store_id` smallint(5) unsigned NOT NULL default '0',
00261 `entity_id` int(10) unsigned NOT NULL default '0',
00262 `position` int(11) NOT NULL default '0',
00263 `value` varchar(255) NOT NULL default '',
00264 PRIMARY KEY (`value_id`),
00265 KEY `IDX_BASE` USING BTREE (`entity_type_id`,`entity_id`,`attribute_id`,`store_id`),
00266 KEY `FK_ATTRIBUTE_GALLERY_ENTITY` (`entity_id`),
00267 KEY `FK_CATALOG_CATEGORY_ENTITY_GALLERY_ATTRIBUTE` (`attribute_id`),
00268 KEY `FK_CATALOG_CATEGORY_ENTITY_GALLERY_STORE` (`store_id`),
00269 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_GALLERY_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00270 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_GALLERY_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00271 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_GALLERY_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00272 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00273
00274 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_int')};
00275 CREATE TABLE {$this->getTable('catalog_product_entity_int')} (
00276 `value_id` int(11) NOT NULL auto_increment,
00277 `entity_type_id` mediumint(8) unsigned NOT NULL default '0',
00278 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00279 `store_id` smallint(5) unsigned NOT NULL default '0',
00280 `entity_id` int(10) unsigned NOT NULL default '0',
00281 `value` int(11) NOT NULL default '0',
00282 PRIMARY KEY (`value_id`),
00283 KEY `FK_CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE` (`attribute_id`),
00284 KEY `FK_CATALOG_PRODUCT_ENTITY_INT_STORE` (`store_id`),
00285 KEY `FK_CATALOG_PRODUCT_ENTITY_INT_PRODUCT_ENTITY` (`entity_id`),
00286 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_INT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00287 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_INT_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00288 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_INT_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00289 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00290
00291 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_text')};
00292 CREATE TABLE {$this->getTable('catalog_product_entity_text')} (
00293 `value_id` int(11) NOT NULL auto_increment,
00294 `entity_type_id` mediumint(8) unsigned NOT NULL default '0',
00295 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00296 `store_id` smallint(5) unsigned NOT NULL default '0',
00297 `entity_id` int(10) unsigned NOT NULL default '0',
00298 `value` text NOT NULL,
00299 PRIMARY KEY (`value_id`),
00300 KEY `FK_CATALOG_PRODUCT_ENTITY_TEXT_ATTRIBUTE` (`attribute_id`),
00301 KEY `FK_CATALOG_PRODUCT_ENTITY_TEXT_STORE` (`store_id`),
00302 KEY `FK_CATALOG_PRODUCT_ENTITY_TEXT_PRODUCT_ENTITY` (`entity_id`),
00303 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TEXT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00304 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TEXT_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00305 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TEXT_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00306 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00307
00308 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_tier_price')};
00309 CREATE TABLE {$this->getTable('catalog_product_entity_tier_price')} (
00310 `value_id` int(11) NOT NULL auto_increment,
00311 `entity_type_id` mediumint(8) unsigned NOT NULL default '0',
00312 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00313 `store_id` smallint(5) unsigned NOT NULL default '0',
00314 `entity_id` int(10) unsigned NOT NULL default '0',
00315 `qty` smallint(5) unsigned NOT NULL default '1',
00316 `value` decimal(12,4) NOT NULL default '0.0000',
00317 PRIMARY KEY (`value_id`),
00318 KEY `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_ATTRIBUTE` (`attribute_id`),
00319 KEY `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_STORE` (`store_id`),
00320 KEY `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_PRODUCT_ENTITY` (`entity_id`),
00321 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00322 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00323 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00324 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00325
00326 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_entity_varchar')};
00327 CREATE TABLE {$this->getTable('catalog_product_entity_varchar')} (
00328 `value_id` int(11) NOT NULL auto_increment,
00329 `entity_type_id` mediumint(8) unsigned NOT NULL default '0',
00330 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00331 `store_id` smallint(5) unsigned NOT NULL default '0',
00332 `entity_id` int(10) unsigned NOT NULL default '0',
00333 `value` varchar(255) NOT NULL default '',
00334 PRIMARY KEY (`value_id`),
00335 KEY `FK_CATALOG_PRODUCT_ENTITY_VARCHAR_ATTRIBUTE` (`attribute_id`),
00336 KEY `FK_CATALOG_PRODUCT_ENTITY_VARCHAR_STORE` (`store_id`),
00337 KEY `FK_CATALOG_PRODUCT_ENTITY_VARCHAR_PRODUCT_ENTITY` (`entity_id`),
00338 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_VARCHAR_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES {$this->getTable('eav_attribute')} (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00339 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_VARCHAR_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00340 CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_VARCHAR_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00341 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00342
00343 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_link')};
00344 CREATE TABLE {$this->getTable('catalog_product_link')} (
00345 `link_id` int(11) unsigned NOT NULL auto_increment,
00346 `product_id` int(10) unsigned NOT NULL default '0',
00347 `linked_product_id` int(10) unsigned NOT NULL default '0',
00348 `link_type_id` tinyint(3) unsigned NOT NULL default '0',
00349 PRIMARY KEY (`link_id`),
00350 KEY `FK_LINK_PRODUCT` (`product_id`),
00351 KEY `FK_LINKED_PRODUCT` (`linked_product_id`),
00352 KEY `FK_PRODUCT_LINK_TYPE` (`link_type_id`),
00353 CONSTRAINT `FK_PRODUCT_LINK_LINKED_PRODUCT` FOREIGN KEY (`linked_product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00354 CONSTRAINT `FK_PRODUCT_LINK_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00355 CONSTRAINT `FK_PRODUCT_LINK_TYPE` FOREIGN KEY (`link_type_id`) REFERENCES {$this->getTable('catalog_product_link_type')} (`link_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00356 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Related products';
00357
00358 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_link_attribute')};
00359 CREATE TABLE {$this->getTable('catalog_product_link_attribute')} (
00360 `product_link_attribute_id` smallint(6) unsigned NOT NULL auto_increment,
00361 `link_type_id` tinyint(3) unsigned NOT NULL default '0',
00362 `product_link_attribute_code` varchar(32) NOT NULL default '',
00363 `data_type` varchar(32) NOT NULL default '',
00364 PRIMARY KEY (`product_link_attribute_id`),
00365 KEY `FK_ATTRIBUTE_PRODUCT_LINK_TYPE` (`link_type_id`),
00366 CONSTRAINT `FK_ATTRIBUTE_PRODUCT_LINK_TYPE` FOREIGN KEY (`link_type_id`) REFERENCES {$this->getTable('catalog_product_link_type')} (`link_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00367 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Attributes for product link';
00368
00369 insert into {$this->getTable('catalog_product_link_attribute')}(`product_link_attribute_id`,`link_type_id`,`product_link_attribute_code`,`data_type`) values (1,2,'qty','decimal'),(2,1,'position','int'),(3,4,'position','int'),(4,5,'position','int'),(6,1,'qty','decimal'),(7,3,'position','int'),(8,3,'qty','decimal');
00370
00371 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_link_attribute_decimal')};
00372 CREATE TABLE {$this->getTable('catalog_product_link_attribute_decimal')} (
00373 `value_id` int(11) unsigned NOT NULL auto_increment,
00374 `product_link_attribute_id` smallint(6) unsigned default NULL,
00375 `link_id` int(11) unsigned default NULL,
00376 `value` decimal(12,4) NOT NULL default '0.0000',
00377 PRIMARY KEY (`value_id`),
00378 KEY `FK_DECIMAL_PRODUCT_LINK_ATTRIBUTE` (`product_link_attribute_id`),
00379 KEY `FK_DECIMAL_LINK` (`link_id`),
00380 CONSTRAINT `FK_DECIMAL_LINK` FOREIGN KEY (`link_id`) REFERENCES {$this->getTable('catalog_product_link')} (`link_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00381 CONSTRAINT `FK_DECIMAL_PRODUCT_LINK_ATTRIBUTE` FOREIGN KEY (`product_link_attribute_id`) REFERENCES {$this->getTable('catalog_product_link_attribute')} (`product_link_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
00382 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Decimal attributes values';
00383
00384 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_link_attribute_int')};
00385 CREATE TABLE {$this->getTable('catalog_product_link_attribute_int')} (
00386 `value_id` int(11) unsigned NOT NULL auto_increment,
00387 `product_link_attribute_id` smallint(6) unsigned default NULL,
00388 `link_id` int(11) unsigned default NULL,
00389 `value` int(11) NOT NULL default '0',
00390 PRIMARY KEY (`value_id`),
00391 KEY `FK_INT_PRODUCT_LINK_ATTRIBUTE` (`product_link_attribute_id`),
00392 KEY `FK_INT_PRODUCT_LINK` (`link_id`),
00393 CONSTRAINT `FK_INT_PRODUCT_LINK` FOREIGN KEY (`link_id`) REFERENCES {$this->getTable('catalog_product_link')} (`link_id`) ON DELETE CASCADE,
00394 CONSTRAINT `FK_INT_PRODUCT_LINK_ATTRIBUTE` FOREIGN KEY (`product_link_attribute_id`) REFERENCES {$this->getTable('catalog_product_link_attribute')} (`product_link_attribute_id`) ON DELETE CASCADE
00395 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00396
00397 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_link_attribute_varchar')};
00398 CREATE TABLE {$this->getTable('catalog_product_link_attribute_varchar')} (
00399 `value_id` int(11) unsigned NOT NULL auto_increment,
00400 `product_link_attribute_id` smallint(6) unsigned NOT NULL default '0',
00401 `link_id` int(11) unsigned default NULL,
00402 `value` varchar(255) NOT NULL default '',
00403 PRIMARY KEY (`value_id`),
00404 KEY `FK_VARCHAR_PRODUCT_LINK_ATTRIBUTE` (`product_link_attribute_id`),
00405 KEY `FK_VARCHAR_LINK` (`link_id`),
00406 CONSTRAINT `FK_VARCHAR_LINK` FOREIGN KEY (`link_id`) REFERENCES {$this->getTable('catalog_product_link')} (`link_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00407 CONSTRAINT `FK_VARCHAR_PRODUCT_LINK_ATTRIBUTE` FOREIGN KEY (`product_link_attribute_id`) REFERENCES {$this->getTable('catalog_product_link_attribute')} (`product_link_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE
00408 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Varchar attributes values';
00409
00410 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_link_type')};
00411 CREATE TABLE {$this->getTable('catalog_product_link_type')} (
00412 `link_type_id` tinyint(3) unsigned NOT NULL auto_increment,
00413 `code` varchar(32) NOT NULL default '',
00414 PRIMARY KEY (`link_type_id`)
00415 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Types of product link(Related, superproduct, bundles)';
00416
00417 insert into {$this->getTable('catalog_product_link_type')}(`link_type_id`,`code`) values (1,'relation'),(2,'bundle'),(3,'super'),(4,'up_sell'),(5,'cross_sell');
00418
00419 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_status')};
00420 CREATE TABLE {$this->getTable('catalog_product_status')} (
00421 `status_id` tinyint(3) unsigned NOT NULL auto_increment,
00422 `status_code` varchar(32) NOT NULL default '',
00423 PRIMARY KEY (`status_id`)
00424 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Available product statuses';
00425
00426 insert into {$this->getTable('catalog_product_status')}(`status_id`,`status_code`) values (1,'Enabled'),(2,'Disabled'),(3,'Out-of-stock');
00427
00428 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_store')};
00429 CREATE TABLE {$this->getTable('catalog_product_store')} (
00430 `store_id` smallint(5) unsigned NOT NULL default '0',
00431 `product_id` int(10) unsigned NOT NULL default '0',
00432 UNIQUE KEY `IDX_PS_UNIQ` (`store_id`,`product_id`),
00433 KEY `store_id` (`store_id`),
00434 KEY `FK_CATALOG_PRDUCT_STORE_PRODUCT` (`product_id`),
00435 CONSTRAINT `FK_CATALOG_PRDUCT_STORE_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00436 CONSTRAINT `FK_CATALOG_PRDUCT_STORE_STORE` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00437 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00438
00439 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_super_attribute')};
00440 CREATE TABLE {$this->getTable('catalog_product_super_attribute')} (
00441 `product_super_attribute_id` int(10) unsigned NOT NULL auto_increment,
00442 `product_id` int(10) unsigned NOT NULL default '0',
00443 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00444 `position` smallint(5) unsigned NOT NULL default '0',
00445 PRIMARY KEY (`product_super_attribute_id`),
00446 KEY `FK_SUPER_PRODUCT_ATTRIBUTE_PRODUCT` (`product_id`),
00447 CONSTRAINT `FK_SUPER_PRODUCT_ATTRIBUTE_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE
00448 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00449
00450 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_super_attribute_label')};
00451 CREATE TABLE {$this->getTable('catalog_product_super_attribute_label')} (
00452 `value_id` int(10) unsigned NOT NULL auto_increment,
00453 `product_super_attribute_id` int(10) unsigned NOT NULL default '0',
00454 `store_id` smallint(5) unsigned NOT NULL default '0',
00455 `value` varchar(255) character set utf8 NOT NULL default '',
00456 PRIMARY KEY (`value_id`),
00457 KEY `FK_SUPER_PRODUCT_ATTRIBUTE_LABEL` (`product_super_attribute_id`),
00458 CONSTRAINT `FK_SUPER_PRODUCT_ATTRIBUTE_LABEL` FOREIGN KEY (`product_super_attribute_id`) REFERENCES {$this->getTable('catalog_product_super_attribute')} (`product_super_attribute_id`) ON DELETE CASCADE
00459 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
00460
00461 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_super_attribute_pricing')};
00462 CREATE TABLE {$this->getTable('catalog_product_super_attribute_pricing')} (
00463 `value_id` int(10) unsigned NOT NULL auto_increment,
00464 `product_super_attribute_id` int(10) unsigned NOT NULL default '0',
00465 `value_index` varchar(255) character set utf8 NOT NULL default '',
00466 `is_percent` tinyint(1) unsigned default '0',
00467 `pricing_value` decimal(10,4) default NULL,
00468 PRIMARY KEY (`value_id`),
00469 KEY `FK_SUPER_PRODUCT_ATTRIBUTE_PRICING` (`product_super_attribute_id`),
00470 CONSTRAINT `FK_SUPER_PRODUCT_ATTRIBUTE_PRICING` FOREIGN KEY (`product_super_attribute_id`) REFERENCES {$this->getTable('catalog_product_super_attribute')} (`product_super_attribute_id`) ON DELETE CASCADE
00471 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00472
00473 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_super_link')};
00474 CREATE TABLE {$this->getTable('catalog_product_super_link')} (
00475 `link_id` int(10) unsigned NOT NULL auto_increment,
00476 `product_id` int(10) unsigned NOT NULL default '0',
00477 `parent_id` int(10) unsigned NOT NULL default '0',
00478 PRIMARY KEY (`link_id`),
00479 KEY `FK_SUPER_PRODUCT_LINK_PARENT` (`parent_id`),
00480 KEY `FK_catalog_product_super_link` (`product_id`),
00481 CONSTRAINT `FK_SUPER_PRODUCT_LINK_ENTITY` FOREIGN KEY (`product_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE,
00482 CONSTRAINT `FK_SUPER_PRODUCT_LINK_PARENT` FOREIGN KEY (`parent_id`) REFERENCES {$this->getTable('catalog_product_entity')} (`entity_id`) ON DELETE CASCADE
00483 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00484
00485 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_type')};
00486 CREATE TABLE {$this->getTable('catalog_product_type')} (
00487 `type_id` tinyint(3) unsigned NOT NULL auto_increment,
00488 `code` varchar(32) NOT NULL default '',
00489 PRIMARY KEY (`type_id`)
00490 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00491
00492 insert into {$this->getTable('catalog_product_type')}(`type_id`,`code`) values (1,'Simple Product'),(2,'bundle'),(3,'Configurable Product'),(4,'Grouped Product');
00493
00494 -- DROP TABLE IF EXISTS {$this->getTable('catalog_product_visibility')};
00495 CREATE TABLE {$this->getTable('catalog_product_visibility')} (
00496 `visibility_id` tinyint(3) unsigned NOT NULL auto_increment,
00497 `visibility_code` varchar(32) NOT NULL default '',
00498 PRIMARY KEY (`visibility_id`)
00499 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Available product visibility';
00500
00501 insert into {$this->getTable('catalog_product_visibility')}(`visibility_id`,`visibility_code`) values (1,'Nowhere'),(2,'Catalog'),(3,'Search'),(4,'Catalog, Search');
00502
00503 insert into {$this->getTable('core_email_template')}(`template_id`,`template_code`,`template_text`,`template_type`,`template_subject`,`template_sender_name`,`template_sender_email`,`added_at`,`modified_at`) values (NULL,'Send product to a friend','Welcome, {{var name}}<br /><br />Please look at <a href=\"{{var product.getProductUrl()}}\">{{var product.name}}</a><br /><br />Here is message: <br />{{var message}}<br /><br />',2,'Welcome, {{var name}}',NULL,NULL,NOW(),NOW());
00504
00505 ALTER TABLE `{$this->getTable('catalog_category_entity')}` ADD `path` VARCHAR( 255 ) NOT NULL, ADD `position` INT NOT NULL;
00506
00507 ALTER TABLE `{$installer->getTable('catalog_category_entity')}` ADD `level` INT NOT NULL;
00508 ALTER TABLE `{$installer->getTable('catalog_category_entity')}` ADD INDEX `IDX_LEVEL` ( `level` );
00509
00510
00511 CREATE TABLE `{$installer->getTable('catalog_category_product_index')}` (
00512 `category_id` int(10) unsigned NOT NULL default '0',
00513 `product_id` int(10) unsigned NOT NULL default '0',
00514 `position` int(10) unsigned NOT NULL default '0',
00515 `is_parent` tinyint(1) unsigned NOT NULL default '0',
00516 UNIQUE KEY `UNQ_CATEGORY_PRODUCT` (`category_id`,`product_id`),
00517 KEY `IDX_CATEGORY_POSITION` (`category_id`,`position`),
00518 CONSTRAINT `FK_CATALOG_CATEGORY_PRODUCT_INDEX_PRODUCT_ENTITY` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00519 CONSTRAINT `FK_CATALOG_CATEGORY_PRODUCT_INDEX_CATEGORY_ENTITY` FOREIGN KEY (`category_id`) REFERENCES `{$installer->getTable('catalog_category_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00520 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00521
00522 CREATE TABLE `{$installer->getTable('catalog_product_enabled_index')}` (
00523 `product_id` int(10) unsigned NOT NULL default '0',
00524 `store_id` smallint(5) unsigned NOT NULL default '0',
00525 `visibility` smallint(5) unsigned NOT NULL default '0',
00526 UNIQUE KEY `UNQ_PRODUCT_STORE` (`product_id`,`store_id`),
00527 KEY `IDX_PRODUCT_VISIBILITY_IN_STORE` (`product_id`,`store_id`, `visibility`),
00528 CONSTRAINT `FK_CATALOG_PRODUCT_ENABLED_INDEX_PRODUCT_ENTITY` FOREIGN KEY (`product_id`) REFERENCES `{$installer->getTable('catalog_product_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00529 CONSTRAINT `FK_CATALOG_PRODUCT_ENABLED_INDEX_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00530 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00531
00532 ALTER TABLE `{$this->getTable('catalog_category_entity')}` ADD `children_count` INT NOT NULL;
00533
00534 ");
00535
00536 }
00537
00538 $installer->endSetup();
00539
00540 $installer->installEntities();
00541
00542
00543 Mage::getModel('catalog/category')
00544 ->setId(1)
00545 ->setPath(1)
00546 ->setName('Root Catalog')
00547 ->setInitialSetupFlag(true)
00548 ->save();
00549
00550 $category = Mage::getModel('catalog/category');
00551
00552
00553 $category->setStoreId(0)
00554 ->setName('Default Category')
00555 ->setDisplayMode('PRODUCTS')
00556 ->setAttributeSetId($category->getDefaultAttributeSetId())
00557 ->setIsActive(1)
00558 ->setPath('1/')
00559 ->setInitialSetupFlag(true)
00560 ->save();
00561
00562 $category->setStoreId(1)
00563 ->save();
00564
00565 $installer->setConfigData('catalog/category/root_id', $category->getId());