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 CREATE TABLE `{$installer->getTable('downloadable/link_purchased')}` (
00034 `purchased_id` int(10) unsigned NOT NULL auto_increment,
00035 `order_item_id` int(10) unsigned NOT NULL default '0',
00036 `order_id` int(10) unsigned NOT NULL default '0',
00037 `number_of_downloads_bought` int(10) unsigned NOT NULL default '0',
00038 `number_of_downloads_used` int(10) unsigned NOT NULL default '0',
00039 `link_id` int(20) unsigned NOT NULL default '0',
00040 `link_title` varchar(255) NOT NULL default '',
00041 `link_url` varchar(255) NOT NULL default '',
00042 `link_file` varchar(255) NOT NULL default '',
00043 `status` varchar(50) NOT NULL default '',
00044 `product_name` varchar(255) NOT NULL default '',
00045 `product_sku` varchar(255) NOT NULL default '',
00046 PRIMARY KEY (`purchased_id`),
00047 KEY `DOWNLOADABLE_ORDER_ITEM_ID` (`order_item_id`),
00048 KEY `DOWNLOADABLE_ORDER_ID` (`order_id`)
00049 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00050 ");
00051
00052 $conn->addConstraint(
00053 'FK_DOWNLOADABLE_ORDER_ITEM_ID', $installer->getTable('downloadable/link_purchased'), 'order_item_id', $installer->getTable('sales/order_item'), 'item_id'
00054 );
00055 $conn->addConstraint(
00056 'FK_DOWNLOADABLE_ORDER_ID', $installer->getTable('downloadable/link_purchased'), 'order_id', $installer->getTable('sales/order'), 'entity_id'
00057 );
00058
00059 $installer->endSetup();