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('catalogrule')};
00035 CREATE TABLE {$this->getTable('catalogrule')} (
00036 `rule_id` int(10) unsigned NOT NULL auto_increment,
00037 `name` varchar(255) NOT NULL default '',
00038 `description` text NOT NULL,
00039 `from_date` date default NULL,
00040 `to_date` date default NULL,
00041 `store_ids` varchar(255) NOT NULL default '',
00042 `customer_group_ids` varchar(255) NOT NULL default '',
00043 `is_active` tinyint(1) NOT NULL default '0',
00044 `conditions_serialized` text NOT NULL,
00045 `actions_serialized` text NOT NULL,
00046 `stop_rules_processing` tinyint(1) NOT NULL default '1',
00047 `sort_order` int(10) unsigned NOT NULL default '0',
00048 PRIMARY KEY (`rule_id`),
00049 KEY `sort_order` (`is_active`,`sort_order`,`to_date`,`from_date`)
00050 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00051
00052
00053 -- DROP TABLE IF EXISTS {$this->getTable('catalogrule_product')};
00054 CREATE TABLE {$this->getTable('catalogrule_product')} (
00055 `rule_product_id` int(10) unsigned NOT NULL auto_increment,
00056 `rule_id` int(10) unsigned NOT NULL default '0',
00057 `from_time` int(10) unsigned NOT NULL default '0',
00058 `to_time` int(10) unsigned NOT NULL default '0',
00059 `store_id` smallint(5) unsigned NOT NULL default '0',
00060 `customer_group_id` smallint(5) unsigned NOT NULL default '0',
00061 `product_id` int(10) unsigned NOT NULL default '0',
00062 `action_operator` enum('to_fixed','to_percent','by_fixed','by_percent') NOT NULL default 'to_fixed',
00063 `action_amount` decimal(12,4) NOT NULL default '0.0000',
00064 `action_stop` tinyint(1) NOT NULL default '0',
00065 `sort_order` int(10) unsigned NOT NULL default '0',
00066 PRIMARY KEY (`rule_product_id`),
00067 UNIQUE KEY `sort_order` (`from_time`,`to_time`,`store_id`,`customer_group_id`,`product_id`,`sort_order`),
00068 KEY `FK_catalogrule_product_rule` (`rule_id`),
00069 KEY `FK_catalogrule_product_store` (`store_id`),
00070 KEY `FK_catalogrule_product_customergroup` (`customer_group_id`),
00071 CONSTRAINT `FK_catalogrule_product_customergroup` FOREIGN KEY (`customer_group_id`) REFERENCES {$this->getTable('customer_group')} (`customer_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00072 CONSTRAINT `FK_catalogrule_product_rule` FOREIGN KEY (`rule_id`) REFERENCES {$this->getTable('catalogrule')} (`rule_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00073 CONSTRAINT `FK_catalogrule_product_store` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00074 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00075
00076 -- DROP TABLE IF EXISTS {$this->getTable('catalogrule_product_price')};
00077 CREATE TABLE {$this->getTable('catalogrule_product_price')} (
00078 `rule_product_price_id` int(10) unsigned NOT NULL auto_increment,
00079 `rule_date` date NOT NULL default '0000-00-00',
00080 `store_id` smallint(5) unsigned NOT NULL default '0',
00081 `customer_group_id` smallint(5) unsigned NOT NULL default '0',
00082 `product_id` int(10) unsigned NOT NULL default '0',
00083 `rule_price` decimal(12,4) NOT NULL default '0.0000',
00084 PRIMARY KEY (`rule_product_price_id`),
00085 UNIQUE KEY `rule_date` (`rule_date`,`store_id`,`customer_group_id`,`product_id`),
00086 KEY `FK_catalogrule_product_price_store` (`store_id`),
00087 KEY `FK_catalogrule_product_price_customergroup` (`customer_group_id`),
00088 CONSTRAINT `FK_catalogrule_product_price_customergroup` FOREIGN KEY (`customer_group_id`) REFERENCES {$this->getTable('customer_group')} (`customer_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00089 CONSTRAINT `FK_catalogrule_product_price_store` FOREIGN KEY (`store_id`) REFERENCES {$this->getTable('core_store')} (`store_id`) ON DELETE CASCADE ON UPDATE CASCADE
00090 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00091
00092 ");
00093
00094 $installer->endSetup();