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 $installer->startSetup();
00030 $installer->run("
00031 CREATE TABLE `{$installer->getTable('sales_flat_quote')}` (
00032 `entity_id` int(10) unsigned NOT NULL auto_increment,
00033 `store_id` smallint(5) unsigned NOT NULL default '0',
00034 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00035 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00036 `converted_at` datetime NOT NULL default '0000-00-00 00:00:00',
00037
00038 `is_active` tinyint(1) unsigned default '1',
00039 `is_virtual` tinyint(1) unsigned default '0',
00040 `is_multi_shipping` tinyint(1) unsigned default '0',
00041
00042 `items_count` int(10) unsigned default '0',
00043 `items_qty` decimal(12,4) default '0.0000',
00044
00045 `orig_order_id` int(10) unsigned default '0',
00046
00047 `store_to_base_rate` decimal(12,4) default '0.0000',
00048 `store_to_quote_rate` decimal(12,4) default '0.0000',
00049 `base_currency_code` varchar(255) default NULL,
00050 `store_currency_code` varchar(255) default NULL,
00051 `quote_currency_code` varchar(255) default NULL,
00052
00053 `grand_total` decimal(12,4) default '0.0000',
00054 `base_grand_total` decimal(12,4) default '0.0000',
00055
00056 `checkout_method` varchar(255) default NULL,
00057
00058 `customer_id` int(10) unsigned default '0',
00059 `customer_tax_class_id` int(10) unsigned default '0',
00060 `customer_group_id` int(10) unsigned default '0',
00061 `customer_email` varchar(255) default NULL,
00062 `customer_prefix` varchar(40) default NULL,
00063 `customer_firstname` varchar(255) default NULL,
00064 `customer_middlename` varchar(40) default NULL,
00065 `customer_lastname` varchar(255) default NULL,
00066 `customer_suffix` varchar(40) default NULL,
00067 `customer_dob` datetime default NULL,
00068 `customer_note` varchar(255) default NULL,
00069 `customer_note_notify` tinyint(1) unsigned default '1',
00070 `customer_is_guest` tinyint(1) unsigned default '0',
00071
00072 `remote_ip` varchar(32) default NULL,
00073 `applied_rule_ids` varchar(255) default NULL,
00074 `reserved_order_id` varchar(64) default '',
00075 `password_hash` varchar(255) default NULL,
00076 `coupon_code` varchar(255) default NULL,
00077 PRIMARY KEY (`entity_id`),
00078 KEY `FK_SALES_QUOTE_STORE` (`store_id`),
00079 KEY `IDX_CUSTOMER` (`customer_id`,`store_id`,`is_active`)
00080 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00081
00082
00083 CREATE TABLE `{$installer->getTable('sales_flat_quote_address')}` (
00084 `address_id` int(10) unsigned NOT NULL auto_increment,
00085 `quote_id` int(10) unsigned NOT NULL default '0',
00086 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00087 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00088
00089 `customer_id` int(10) unsigned default NULL,
00090 `save_in_address_book` tinyint(1) default '0',
00091 `customer_address_id` int(10) unsigned default NULL,
00092 `address_type` varchar(255) default NULL,
00093 `email` varchar(255) default NULL,
00094 `prefix` varchar(40) default NULL,
00095 `firstname` varchar(255) default NULL,
00096 `middlename` varchar(40) default NULL,
00097 `lastname` varchar(255) default NULL,
00098 `suffix` varchar(40) default NULL,
00099 `company` varchar(255) default NULL,
00100 `street` varchar(255) default NULL,
00101 `city` varchar(255) default NULL,
00102 `region` varchar(255) default NULL,
00103 `region_id` int(10) unsigned default NULL,
00104 `postcode` varchar(255) default NULL,
00105 `country_id` varchar(255) default NULL,
00106 `telephone` varchar(255) default NULL,
00107 `fax` varchar(255) default NULL,
00108
00109 `same_as_billing` tinyint(1) unsigned NOT NULL default '0',
00110 `free_shipping` tinyint(1) unsigned NOT NULL default '0',
00111 `collect_shipping_rates` tinyint(1) unsigned NOT NULL default '0',
00112 `shipping_method` varchar(255) NOT NULL default '',
00113 `shipping_description` varchar(255) NOT NULL default '',
00114 `weight` decimal(12,4) NOT NULL default '0.0000',
00115
00116 `subtotal` decimal(12,4) NOT NULL default '0.0000',
00117 `base_subtotal` decimal(12,4) NOT NULL default '0.0000',
00118 `subtotal_with_discount` decimal(12,4) NOT NULL default '0.0000',
00119 `base_subtotal_with_discount` decimal(12,4) NOT NULL default '0.0000',
00120 `tax_amount` decimal(12,4) NOT NULL default '0.0000',
00121 `base_tax_amount` decimal(12,4) NOT NULL default '0.0000',
00122 `shipping_amount` decimal(12,4) NOT NULL default '0.0000',
00123 `base_shipping_amount` decimal(12,4) NOT NULL default '0.0000',
00124 `shipping_tax_amount` decimal(12,4) default NULL,
00125 `base_shipping_tax_amount` decimal(12,4) default NULL,
00126 `discount_amount` decimal(12,4) NOT NULL default '0.0000',
00127 `base_discount_amount` decimal(12,4) NOT NULL default '0.0000',
00128 `grand_total` decimal(12,4) NOT NULL default '0.0000',
00129 `base_grand_total` decimal(12,4) NOT NULL default '0.0000',
00130
00131 `customer_notes` text,
00132 PRIMARY KEY (`address_id`),
00133 KEY `FK_SALES_QUOTE_ADDRESS_SALES_QUOTE` (`quote_id`),
00134 CONSTRAINT `FK_SALES_QUOTE_ADDRESS_SALES_QUOTE` FOREIGN KEY (`quote_id`) REFERENCES `{$installer->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00135 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00136
00137 CREATE TABLE `{$installer->getTable('sales_flat_quote_address_item')}` (
00138 `address_item_id` int(10) unsigned NOT NULL auto_increment,
00139 `quote_address_id` int(10) unsigned NOT NULL default '0',
00140 `quote_item_id` int(10) unsigned NOT NULL default '0',
00141 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00142 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00143
00144 `applied_rule_ids` text,
00145 `additional_data` text,
00146 `weight` decimal(12,4) default '0.0000',
00147 `qty` decimal(12,4) NOT NULL default '0.0000',
00148 `discount_amount` decimal(12,4) default '0.0000',
00149 `tax_amount` decimal(12,4) default '0.0000',
00150
00151 `row_total` decimal(12,4) NOT NULL default '0.0000',
00152 `base_row_total` decimal(12,4) NOT NULL default '0.0000',
00153 `row_total_with_discount` decimal(12,4) default '0.0000',
00154 `base_discount_amount` decimal(12,4) default '0.0000',
00155 `base_tax_amount` decimal(12,4) default '0.0000',
00156 `row_weight` decimal(12,4) default '0.0000',
00157 PRIMARY KEY (`address_item_id`),
00158 KEY `FK_QUOTE_ADDRESS_ITEM_QUOTE_ADDRESS` (`quote_address_id`),
00159 KEY `FK_SALES_QUOTE_ADDRESS_ITEM_QUOTE_ITEM` (`quote_item_id`),
00160 CONSTRAINT `FK_QUOTE_ADDRESS_ITEM_QUOTE_ADDRESS` FOREIGN KEY (`quote_address_id`) REFERENCES `{$installer->getTable('sales_flat_quote_address')}` (`address_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00161 CONSTRAINT `FK_SALES_QUOTE_ADDRESS_ITEM_QUOTE_ITEM` FOREIGN KEY (`quote_item_id`) REFERENCES `{$installer->getTable('sales_flat_quote_item')}` (`item_id`)
00162 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00163
00164 CREATE TABLE `{$installer->getTable('sales_flat_quote_item')}` (
00165 `item_id` int(10) unsigned NOT NULL auto_increment,
00166 `quote_id` int(10) unsigned NOT NULL default '0',
00167 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00168 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00169
00170 `product_id` int(10) unsigned default NULL,
00171 `super_product_id` int(10) unsigned default NULL,
00172 `parent_product_id` int(10) unsigned default NULL,
00173 `is_virtual` tinyint(1) unsigned default NULL,
00174
00175 `sku` varchar(255) NOT NULL default '',
00176 `name` varchar(255) default NULL,
00177 `description` text,
00178 `applied_rule_ids` text,
00179 `additional_data` text,
00180 `free_shipping` tinyint(1) unsigned NOT NULL default '0',
00181 `is_qty_decimal` tinyint(1) unsigned default NULL,
00182 `no_discount` tinyint(1) unsigned default '0',
00183
00184 `weight` decimal(12,4) default '0.0000',
00185 `qty` decimal(12,4) NOT NULL default '0.0000',
00186 `price` decimal(12,4) NOT NULL default '0.0000',
00187 `base_price` decimal(12,4) NOT NULL default '0.0000',
00188 `custom_price` decimal(12,4) default NULL,
00189 `discount_percent` decimal(12,4) default '0.0000',
00190 `discount_amount` decimal(12,4) default '0.0000',
00191 `base_discount_amount` decimal(12,4) default '0.0000',
00192 `tax_percent` decimal(12,4) default '0.0000',
00193 `tax_amount` decimal(12,4) default '0.0000',
00194 `base_tax_amount` decimal(12,4) default '0.0000',
00195 `row_total` decimal(12,4) NOT NULL default '0.0000',
00196 `base_row_total` decimal(12,4) NOT NULL default '0.0000',
00197 `row_total_with_discount` decimal(12,4) default '0.0000',
00198 `row_weight` decimal(12,4) default '0.0000',
00199 PRIMARY KEY (`item_id`),
00200 KEY `FK_SALES_QUOTE_ITEM_SALES_QUOTE` (`quote_id`),
00201 CONSTRAINT `FK_SALES_QUOTE_ITEM_SALES_QUOTE` FOREIGN KEY (`quote_id`) REFERENCES `{$installer->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00202 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00203
00204 CREATE TABLE `{$installer->getTable('sales_flat_quote_item_option')}` (
00205 `option_id` int(10) unsigned NOT NULL auto_increment,
00206 `item_id` int(10) unsigned NOT NULL,
00207 `product_id` int(10) unsigned NOT NULL,
00208 `code` varchar(255) NOT NULL,
00209 `value` text NOT NULL,
00210 PRIMARY KEY (`option_id`),
00211 KEY `FK_SALES_QUOTE_ITEM_OPTION_ITEM_ID` (`item_id`),
00212 CONSTRAINT `FK_SALES_QUOTE_ITEM_OPTION_ITEM_ID` FOREIGN KEY (`item_id`) REFERENCES `{$installer->getTable('sales_flat_quote_item')}` (`item_id`) ON DELETE CASCADE ON UPDATE CASCADE
00213 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Additional options for quote item';
00214
00215 CREATE TABLE `{$installer->getTable('sales_flat_quote_payment')}` (
00216 `payment_id` int(10) unsigned NOT NULL auto_increment,
00217 `quote_id` int(10) unsigned NOT NULL default '0',
00218 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00219 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00220 `method` varchar(255) default '',
00221
00222 `cc_type` varchar(255) default '',
00223 `cc_number_enc` varchar(255) default '',
00224 `cc_last4` varchar(255) default '',
00225 `cc_cid_enc` varchar(255) default '',
00226 `cc_owner` varchar(255) default '',
00227 `cc_exp_month` tinyint(2) unsigned default '0',
00228 `cc_exp_year` smallint(4) unsigned default '0',
00229 `cc_ss_owner` varchar(255) default '',
00230 `cc_ss_start_month` tinyint(2) unsigned default '0',
00231 `cc_ss_start_year` smallint(4) unsigned default '0',
00232
00233 `cybersource_token` varchar(255) default '',
00234 `paypal_correlation_id` varchar(255) default '',
00235 `paypal_payer_id` varchar(255) default '',
00236 `paypal_payer_status` varchar(255) default '',
00237 `po_number` varchar(255) default '',
00238 PRIMARY KEY (`payment_id`),
00239 KEY `FK_SALES_QUOTE_PAYMENT_SALES_QUOTE` (`quote_id`),
00240 CONSTRAINT `FK_SALES_QUOTE_PAYMENT_SALES_QUOTE` FOREIGN KEY (`quote_id`) REFERENCES `{$installer->getTable('sales_flat_quote')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE
00241 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00242
00243 CREATE TABLE `{$installer->getTable('sales_flat_quote_shipping_rate')}` (
00244 `rate_id` int(10) unsigned NOT NULL auto_increment,
00245 `address_id` int(10) unsigned NOT NULL default '0',
00246 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00247 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00248
00249 `carrier` varchar(255) default NULL,
00250 `carrier_title` varchar(255) default NULL,
00251 `code` varchar(255) default NULL,
00252 `method` varchar(255) default NULL,
00253 `method_description` text,
00254 `price` decimal(12,4) NOT NULL default '0.0000',
00255 PRIMARY KEY (`rate_id`),
00256 KEY `FK_SALES_QUOTE_SHIPPING_RATE_ADDRESS` (`address_id`),
00257 CONSTRAINT `FK_SALES_QUOTE_SHIPPING_RATE_ADDRESS` FOREIGN KEY (`address_id`) REFERENCES `{$installer->getTable('sales_flat_quote_address')}` (`address_id`) ON DELETE CASCADE ON UPDATE CASCADE
00258 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00259
00260 CREATE TABLE `{$installer->getTable('sales_order')}` (
00261 `entity_id` int(10) unsigned NOT NULL auto_increment,
00262 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00263 `attribute_set_id` smallint(5) unsigned NOT NULL default '0',
00264 `increment_id` varchar(50) NOT NULL default '',
00265 `parent_id` int(10) unsigned NOT NULL default '0',
00266 `store_id` smallint(5) unsigned default NULL,
00267 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00268 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00269 `is_active` tinyint(1) unsigned NOT NULL default '1',
00270 `customer_id` int(11) default NULL,
00271 `tax_amount` decimal(12,4) NOT NULL default '0.0000',
00272 `shipping_amount` decimal(12,4) NOT NULL default '0.0000',
00273 `discount_amount` decimal(12,4) NOT NULL default '0.0000',
00274 `subtotal` decimal(12,4) NOT NULL default '0.0000',
00275 `grand_total` decimal(12,4) NOT NULL default '0.0000',
00276 `total_paid` decimal(12,4) NOT NULL default '0.0000',
00277 `total_refunded` decimal(12,4) NOT NULL default '0.0000',
00278 `total_qty_ordered` decimal(12,4) NOT NULL default '0.0000',
00279 `total_canceled` decimal(12,4) NOT NULL default '0.0000',
00280 `total_invoiced` decimal(12,4) NOT NULL default '0.0000',
00281 `total_online_refunded` decimal(12,4) NOT NULL default '0.0000',
00282 `total_offline_refunded` decimal(12,4) NOT NULL default '0.0000',
00283 `base_tax_amount` decimal(12,4) NOT NULL default '0.0000',
00284 `base_shipping_amount` decimal(12,4) NOT NULL default '0.0000',
00285 `base_discount_amount` decimal(12,4) NOT NULL default '0.0000',
00286 `base_subtotal` decimal(12,4) NOT NULL default '0.0000',
00287 `base_grand_total` decimal(12,4) NOT NULL default '0.0000',
00288 `base_total_paid` decimal(12,4) NOT NULL default '0.0000',
00289 `base_total_refunded` decimal(12,4) NOT NULL default '0.0000',
00290 `base_total_qty_ordered` decimal(12,4) NOT NULL default '0.0000',
00291 `base_total_canceled` decimal(12,4) NOT NULL default '0.0000',
00292 `base_total_invoiced` decimal(12,4) NOT NULL default '0.0000',
00293 `base_total_online_refunded` decimal(12,4) NOT NULL default '0.0000',
00294 `base_total_offline_refunded` decimal(12,4) NOT NULL default '0.0000',
00295 `subtotal_refunded` decimal(12,4) default NULL,
00296 `subtotal_canceled` decimal(12,4) default NULL,
00297 `tax_refunded` decimal(12,4) default NULL,
00298 `tax_canceled` decimal(12,4) default NULL,
00299 `shipping_refunded` decimal(12,4) default NULL,
00300 `shipping_canceled` decimal(12,4) default NULL,
00301 `base_subtotal_refunded` decimal(12,4) default NULL,
00302 `base_subtotal_canceled` decimal(12,4) default NULL,
00303 `base_tax_refunded` decimal(12,4) default NULL,
00304 `base_tax_canceled` decimal(12,4) default NULL,
00305 `base_shipping_refunded` decimal(12,4) default NULL,
00306 `base_shipping_canceled` decimal(12,4) default NULL,
00307 `subtotal_invoiced` decimal(12,4) default NULL,
00308 `tax_invoiced` decimal(12,4) default NULL,
00309 `shipping_invoiced` decimal(12,4) default NULL,
00310 `base_subtotal_invoiced` decimal(12,4) default NULL,
00311 `base_tax_invoiced` decimal(12,4) default NULL,
00312 `base_shipping_invoiced` decimal(12,4) default NULL,
00313 `shipping_tax_amount` decimal(12,4) default NULL,
00314 `base_shipping_tax_amount` decimal(12,4) default NULL,
00315 PRIMARY KEY (`entity_id`),
00316 KEY `FK_SALES_ORDER_TYPE` (`entity_type_id`),
00317 KEY `FK_SALES_ORDER_STORE` (`store_id`),
00318 KEY `IDX_CUSTOMER` (`customer_id`),
00319 CONSTRAINT `FK_SALE_ORDER_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE,
00320 CONSTRAINT `FK_SALE_ORDER_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00321 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
00322
00323 CREATE TABLE `{$this->getTable('sales_order')}_datetime` (
00324 `value_id` int(11) NOT NULL auto_increment,
00325 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00326 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00327 `entity_id` int(10) unsigned NOT NULL default '0',
00328 `value` datetime NOT NULL default '0000-00-00 00:00:00',
00329 PRIMARY KEY (`value_id`),
00330 KEY `FK_SALES_ORDER_DATETIME_ENTITY_TYPE` (`entity_type_id`),
00331 KEY `FK_SALES_ORDER_DATETIME_ATTRIBUTE` (`attribute_id`),
00332 KEY `FK_SALES_ORDER_DATETIME` (`entity_id`),
00333 CONSTRAINT `FK_SALES_ORDER_DATETIME` FOREIGN KEY (`entity_id`) REFERENCES `{$this->getTable('sales_order')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00334 CONSTRAINT `FK_SALES_ORDER_DATETIME_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00335 CONSTRAINT `FK_SALES_ORDER_DATETIME_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00336 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00337
00338 CREATE TABLE `{$this->getTable('sales_order')}_decimal` (
00339 `value_id` int(11) NOT NULL auto_increment,
00340 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00341 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00342 `entity_id` int(10) unsigned NOT NULL default '0',
00343 `value` decimal(12,4) NOT NULL default '0.0000',
00344 PRIMARY KEY (`value_id`),
00345 KEY `FK_SALES_ORDER_DECIMAL_ENTITY_TYPE` (`entity_type_id`),
00346 KEY `FK_SALES_ORDER_DECIMAL_ATTRIBUTE` (`attribute_id`),
00347 KEY `FK_SALES_ORDER_DECIMAL` (`entity_id`),
00348 CONSTRAINT `FK_SALES_ORDER_DECIMAL` FOREIGN KEY (`entity_id`) REFERENCES `{$this->getTable('sales_order')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00349 CONSTRAINT `FK_SALES_ORDER_DECIMAL_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00350 CONSTRAINT `FK_SALES_ORDER_DECIMAL_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00351 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00352
00353 CREATE TABLE `{$this->getTable('sales_order')}_int` (
00354 `value_id` int(11) NOT NULL auto_increment,
00355 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00356 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00357 `entity_id` int(10) unsigned NOT NULL default '0',
00358 `value` int(11) NOT NULL default '0',
00359 PRIMARY KEY (`value_id`),
00360 KEY `FK_SALES_ORDER_INT_ENTITY_TYPE` (`entity_type_id`),
00361 KEY `FK_SALES_ORDER_INT_ATTRIBUTE` (`attribute_id`),
00362 KEY `FK_SALES_ORDER_INT` (`entity_id`),
00363 CONSTRAINT `FK_SALES_ORDER_INT` FOREIGN KEY (`entity_id`) REFERENCES `{$this->getTable('sales_order')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00364 CONSTRAINT `FK_SALES_ORDER_INT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00365 CONSTRAINT `FK_SALES_ORDER_INT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00366 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00367
00368 CREATE TABLE `{$this->getTable('sales_order')}_text` (
00369 `value_id` int(11) NOT NULL auto_increment,
00370 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00371 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00372 `entity_id` int(10) unsigned NOT NULL default '0',
00373 `value` text NOT NULL,
00374 PRIMARY KEY (`value_id`),
00375 KEY `FK_SALES_ORDER_TEXT_ENTITY_TYPE` (`entity_type_id`),
00376 KEY `FK_SALES_ORDER_TEXT_ATTRIBUTE` (`attribute_id`),
00377 KEY `FK_SALES_ORDER_TEXT` (`entity_id`),
00378 CONSTRAINT `FK_SALES_ORDER_TEXT` FOREIGN KEY (`entity_id`) REFERENCES `{$this->getTable('sales_order')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00379 CONSTRAINT `FK_SALES_ORDER_TEXT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00380 CONSTRAINT `FK_SALES_ORDER_TEXT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00381 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00382
00383 CREATE TABLE `{$this->getTable('sales_order')}_varchar` (
00384 `value_id` int(11) NOT NULL auto_increment,
00385 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00386 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00387 `entity_id` int(10) unsigned NOT NULL default '0',
00388 `value` varchar(255) NOT NULL default '',
00389 PRIMARY KEY (`value_id`),
00390 KEY `FK_SALES_ORDER_VARCHAR_ENTITY_TYPE` (`entity_type_id`),
00391 KEY `FK_SALES_ORDER_VARCHAR_ATTRIBUTE` (`attribute_id`),
00392 KEY `FK_SALES_ORDER_VARCHAR` (`entity_id`),
00393 CONSTRAINT `FK_SALES_ORDER_VARCHAR` FOREIGN KEY (`entity_id`) REFERENCES `{$this->getTable('sales_order')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00394 CONSTRAINT `FK_SALES_ORDER_VARCHAR_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00395 CONSTRAINT `FK_SALES_ORDER_VARCHAR_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00396 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00397
00398 CREATE TABLE `{$installer->getTable('sales_order_entity')}` (
00399 `entity_id` int(10) unsigned NOT NULL auto_increment,
00400 `entity_type_id` smallint(8) unsigned NOT NULL default '0',
00401 `attribute_set_id` smallint(5) unsigned NOT NULL default '0',
00402 `increment_id` varchar(50) NOT NULL default '',
00403 `parent_id` int(10) unsigned NOT NULL default '0',
00404 `store_id` smallint(5) unsigned default NULL,
00405 `created_at` datetime NOT NULL default '0000-00-00 00:00:00',
00406 `updated_at` datetime NOT NULL default '0000-00-00 00:00:00',
00407 `is_active` tinyint(1) unsigned NOT NULL default '1',
00408 PRIMARY KEY (`entity_id`),
00409 KEY `FK_SALES_ORDER_ENTITY_TYPE` (`entity_type_id`),
00410 KEY `FK_SALES_ORDER_ENTITY_STORE` (`store_id`),
00411 CONSTRAINT `FK_SALES_ORDER_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$installer->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00412 CONSTRAINT `FK_SALE_ORDER_ENTITY_STORE` FOREIGN KEY (`store_id`) REFERENCES `{$installer->getTable('core_store')}` (`store_id`) ON DELETE SET NULL ON UPDATE CASCADE
00413 ) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
00414
00415 CREATE TABLE `{$this->getTable('sales_order_entity')}_datetime` (
00416 `value_id` int(11) NOT NULL auto_increment,
00417 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00418 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00419 `entity_id` int(10) unsigned NOT NULL default '0',
00420 `value` datetime NOT NULL default '0000-00-00 00:00:00',
00421 PRIMARY KEY (`value_id`),
00422 KEY `FK_SALES_ORDER_ENTITY_DATETIME_ENTITY_TYPE` (`entity_type_id`),
00423 KEY `FK_SALES_ORDER_ENTITY_DATETIME_ATTRIBUTE` (`attribute_id`),
00424 KEY `FK_SALES_ORDER_ENTITY_DATETIME` (`entity_id`),
00425 CONSTRAINT `FK_SALES_ORDER_ENTITY_DATETIME` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('sales_order_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00426 CONSTRAINT `FK_SALES_ORDER_ENTITY_DATETIME_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00427 CONSTRAINT `FK_SALES_ORDER_ENTITY_DATETIME_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00428 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00429
00430 CREATE TABLE `{$installer->getTable('sales_order_entity')}_decimal` (
00431 `value_id` int(11) NOT NULL auto_increment,
00432 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00433 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00434 `entity_id` int(10) unsigned NOT NULL default '0',
00435 `value` decimal(12,4) NOT NULL default '0.0000',
00436 PRIMARY KEY (`value_id`),
00437 KEY `FK_SALES_ORDER_ENTITY_DECIMAL_ENTITY_TYPE` (`entity_type_id`),
00438 KEY `FK_SALES_ORDER_ENTITY_DECIMAL_ATTRIBUTE` (`attribute_id`),
00439 KEY `FK_SALES_ORDER_ENTITY_DECIMAL` (`entity_id`),
00440 CONSTRAINT `FK_SALES_ORDER_ENTITY_DECIMAL` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('sales_order_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00441 CONSTRAINT `FK_SALES_ORDER_ENTITY_DECIMAL_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00442 CONSTRAINT `FK_SALES_ORDER_ENTITY_DECIMAL_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00443 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00444
00445 CREATE TABLE `{$installer->getTable('sales_order_entity')}_int` (
00446 `value_id` int(11) NOT NULL auto_increment,
00447 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00448 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00449 `entity_id` int(10) unsigned NOT NULL default '0',
00450 `value` int(11) NOT NULL default '0',
00451 PRIMARY KEY (`value_id`),
00452 KEY `FK_SALES_ORDER_ENTITY_INT_ENTITY_TYPE` (`entity_type_id`),
00453 KEY `FK_SALES_ORDER_ENTITY_INT_ATTRIBUTE` (`attribute_id`),
00454 KEY `FK_SALES_ORDER_ENTITY_INT` (`entity_id`),
00455 CONSTRAINT `FK_SALES_ORDER_ENTITY_INT` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('sales_order_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00456 CONSTRAINT `FK_SALES_ORDER_ENTITY_INT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00457 CONSTRAINT `FK_SALES_ORDER_ENTITY_INT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00458 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00459
00460 CREATE TABLE `{$installer->getTable('sales_order_entity')}_text` (
00461 `value_id` int(11) NOT NULL auto_increment,
00462 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00463 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00464 `entity_id` int(10) unsigned NOT NULL default '0',
00465 `value` text NOT NULL,
00466 PRIMARY KEY (`value_id`),
00467 KEY `FK_SALES_ORDER_ENTITY_TEXT_ENTITY_TYPE` (`entity_type_id`),
00468 KEY `FK_SALES_ORDER_ENTITY_TEXT_ATTRIBUTE` (`attribute_id`),
00469 KEY `FK_SALES_ORDER_ENTITY_TEXT` (`entity_id`),
00470 CONSTRAINT `FK_SALES_ORDER_ENTITY_TEXT` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('sales_order_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00471 CONSTRAINT `FK_SALES_ORDER_ENTITY_TEXT_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00472 CONSTRAINT `FK_SALES_ORDER_ENTITY_TEXT_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00473 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00474
00475 CREATE TABLE `{$installer->getTable('sales_order_entity')}_varchar` (
00476 `value_id` int(11) NOT NULL auto_increment,
00477 `entity_type_id` smallint(5) unsigned NOT NULL default '0',
00478 `attribute_id` smallint(5) unsigned NOT NULL default '0',
00479 `entity_id` int(10) unsigned NOT NULL default '0',
00480 `value` varchar(255) NOT NULL default '',
00481 PRIMARY KEY (`value_id`),
00482 KEY `FK_SALES_ORDER_ENTITY_VARCHAR_ENTITY_TYPE` (`entity_type_id`),
00483 KEY `FK_SALES_ORDER_ENTITY_VARCHAR_ATTRIBUTE` (`attribute_id`),
00484 KEY `FK_SALES_ORDER_ENTITY_VARCHAR` (`entity_id`),
00485 CONSTRAINT `FK_SALES_ORDER_ENTITY_VARCHAR` FOREIGN KEY (`entity_id`) REFERENCES `{$installer->getTable('sales_order_entity')}` (`entity_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00486 CONSTRAINT `FK_SALES_ORDER_ENTITY_VARCHAR_ATTRIBUTE` FOREIGN KEY (`attribute_id`) REFERENCES `{$this->getTable('eav_attribute')}` (`attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
00487 CONSTRAINT `FK_SALES_ORDER_ENTITY_VARCHAR_ENTITY_TYPE` FOREIGN KEY (`entity_type_id`) REFERENCES `{$this->getTable('eav_entity_type')}` (`entity_type_id`) ON DELETE CASCADE ON UPDATE CASCADE
00488 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00489
00490 ");
00491
00492 $installer->installEntities();
00493 $installer->endSetup();