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 DROP TABLE IF EXISTS `{$this->getTable('catalog/product_option')}`;
00034 CREATE TABLE `{$this->getTable('catalog/product_option')}` (
00035 `option_id` int(10) unsigned NOT NULL auto_increment,
00036 `product_id` int(10) unsigned NOT NULL default '0',
00037 `type` varchar(50) NOT NULL default '',
00038 `is_require` tinyint(1) NOT NULL default '1',
00039 `sku` varchar(64) NOT NULL default '',
00040 `max_characters` int(10) unsigned default NULL,
00041 `file_extension` varchar(50) default NULL,
00042 `sort_order` int(10) unsigned NOT NULL default '0',
00043 PRIMARY KEY (`option_id`),
00044 KEY `CATALOG_PRODUCT_OPTION_PRODUCT` (`product_id`),
00045 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_PRODUCT` FOREIGN KEY (`product_id`) REFERENCES `{$this->getTable('catalog/product')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00046 )ENGINE=InnoDB default CHARSET=utf8;
00047
00048 DROP TABLE IF EXISTS `{$this->getTable('catalog/product_option_price')}`;
00049 CREATE TABLE `{$this->getTable('catalog/product_option_price')}` (
00050 `option_price_id` int(10) unsigned NOT NULL auto_increment,
00051 `option_id` int(10) unsigned NOT NULL default '0',
00052 `store_id` smallint(5) unsigned NOT NULL default '0',
00053 `price` decimal(12,4) NOT NULL default '0.00',
00054 `price_type` enum('fixed', 'percent') NOT NULL default 'fixed',
00055 PRIMARY KEY (`option_price_id`),
00056 KEY `CATALOG_PRODUCT_OPTION_PRICE_OPTION` (`option_id`),
00057 KEY `CATALOG_PRODUCT_OPTION_TITLE_STORE` (`store_id`),
00058 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_PRICE_OPTION` FOREIGN KEY (`option_id`) REFERENCES `{$this->getTable('catalog/product_option')}` (`option_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00059 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_PRICE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00060 )ENGINE=InnoDB default CHARSET=utf8;
00061
00062 DROP TABLE IF EXISTS `{$this->getTable('catalog/product_option_title')}`;
00063 CREATE TABLE `{$this->getTable('catalog/product_option_title')}` (
00064 `option_title_id` int(10) unsigned NOT NULL auto_increment,
00065 `option_id` int(10) unsigned NOT NULL default '0',
00066 `store_id` smallint(5) unsigned NOT NULL default '0',
00067 `title` VARCHAR(50) NOT NULL default '',
00068 PRIMARY KEY (`option_title_id`),
00069 KEY `CATALOG_PRODUCT_OPTION_TITLE_OPTION` (`option_id`),
00070 KEY `CATALOG_PRODUCT_OPTION_TITLE_STORE` (`store_id`),
00071 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TITLE_OPTION` FOREIGN KEY (`option_id`) REFERENCES `{$this->getTable('catalog/product_option')}` (`option_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00072 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TITLE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00073 )ENGINE=InnoDB default CHARSET=utf8;
00074
00075 DROP TABLE IF EXISTS `{$this->getTable('catalog/product_option_type_value')}`;
00076 CREATE TABLE `{$this->getTable('catalog/product_option_type_value')}` (
00077 `option_type_id` int(10) unsigned NOT NULL auto_increment,
00078 `option_id` int(10) unsigned NOT NULL default '0',
00079 `sku` varchar(64) NOT NULL default '',
00080 PRIMARY KEY (`option_type_id`),
00081 KEY `CATALOG_PRODUCT_OPTION_TYPE_VALUE_OPTION` (`option_id`),
00082 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_VALUE_OPTION` FOREIGN KEY (`option_id`) REFERENCES `{$this->getTable('catalog/product_option')}` (`option_id`) ON DELETE CASCADE ON UPDATE CASCADE
00083 )ENGINE=InnoDB default CHARSET=utf8;
00084
00085 DROP TABLE IF EXISTS `{$this->getTable('catalog/product_option_type_price')}`;
00086 CREATE TABLE `{$this->getTable('catalog/product_option_type_price')}` (
00087 `option_type_price_id` int(10) unsigned NOT NULL auto_increment,
00088 `option_type_id` int(10) unsigned NOT NULL default '0',
00089 `store_id` smallint(5) unsigned NOT NULL default '0',
00090 `price` decimal(12,4) NOT NULL default '0.00',
00091 `price_type` enum('fixed','percent') NOT NULL default 'fixed',
00092 PRIMARY KEY (`option_type_price_id`),
00093 KEY `CATALOG_PRODUCT_OPTION_TYPE_PRICE_OPTION_TYPE` (`option_type_id`),
00094 KEY `CATALOG_PRODUCT_OPTION_TYPE_PRICE_STORE` (`store_id`),
00095 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_PRICE_OPTION` FOREIGN KEY (`option_type_id`) REFERENCES `{$this->getTable('catalog/product_option_type_value')}` (`option_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00096 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_PRICE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00097 )ENGINE=InnoDB default CHARSET=utf8;
00098
00099 DROP TABLE IF EXISTS `{$this->getTable('catalog/product_option_type_title')}`;
00100 CREATE TABLE `{$this->getTable('catalog/product_option_type_title')}` (
00101 `option_type_title_id` int(10) unsigned NOT NULL auto_increment,
00102 `option_type_id` int(10) unsigned NOT NULL default '0',
00103 `store_id` smallint(5) unsigned NOT NULL default '0',
00104 `title` varchar(50) NOT NULL default '',
00105 PRIMARY KEY (`option_type_title_id`),
00106 KEY `CATALOG_PRODUCT_OPTION_TYPE_TITLE_OPTION` (`option_type_id`),
00107 KEY `CATALOG_PRODUCT_OPTION_TYPE_TITLE_STORE` (`store_id`),
00108 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_TITLE_OPTION` FOREIGN KEY (`option_type_id`) REFERENCES `{$this->getTable('catalog/product_option_type_value')}` (`option_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00109 CONSTRAINT `FK_CATALOG_PRODUCT_OPTION_TYPE_TITLE_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$this->getTable('core/store')}` (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00110 )ENGINE=InnoDB default CHARSET=utf8;
00111 ");
00112
00113 $installer->endSetup();