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 $conn = $installer->getConnection();
00031
00032
00033 $installer->startSetup();
00034
00035 $installer->run("
00036 CREATE TABLE `{$installer->getTable('downloadable/sample')}` (
00037 `sample_id` int(10) unsigned NOT NULL auto_increment,
00038 `product_id` int(10) unsigned NOT NULL default '0',
00039 `sample_file` varchar(255) NOT NULL default '',
00040 `sort_order` int(10) unsigned NOT NULL default '0',
00041 PRIMARY KEY (`sample_id`),
00042 KEY `DOWNLODABLE_SAMPLE_PRODUCT` (`product_id`)
00043 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00044 ");
00045
00046 $conn->addConstraint(
00047 'FK_DOWNLODABLE_SAMPLE_PRODUCT', $installer->getTable('downloadable/sample'), 'product_id', $installer->getTable('catalog/product'), 'entity_id'
00048 );
00049
00050 $installer->run("
00051 CREATE TABLE `{$installer->getTable('downloadable/sample_title')}` (
00052 `title_id` int(10) unsigned NOT NULL auto_increment,
00053 `sample_id` int(10) unsigned NOT NULL default '0',
00054 `store_id` smallint(5) unsigned NOT NULL default '0',
00055 `title` varchar(255) NOT NULL default '',
00056 PRIMARY KEY (`title_id`),
00057 KEY `DOWNLOADABLE_SAMPLE_TITLE_SAMPLE` (`sample_id`),
00058 KEY `DOWNLOADABLE_SAMPLE_TITLE_STORE` (`store_id`)
00059 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00060 ");
00061
00062 $conn->addConstraint(
00063 'FK_DOWNLOADABLE_SAMPLE_TITLE_SAMPLE', $installer->getTable('downloadable/sample_title'), 'sample_id', $installer->getTable('downloadable/sample'), 'sample_id'
00064 );
00065 $conn->addConstraint(
00066 'FK_DOWNLOADABLE_SAMPLE_TITLE_STORE', $installer->getTable('downloadable/sample_title'), 'store_id', $installer->getTable('core/store'), 'store_id'
00067 );
00068
00069 $installer->run("
00070 CREATE TABLE `{$installer->getTable('downloadable/link')}` (
00071 `link_id` int(10) unsigned NOT NULL auto_increment,
00072 `product_id` int(10) unsigned NOT NULL default '0',
00073 `sort_order` int(10) unsigned NOT NULL default '0',
00074 `number_of_downloads` int(10) unsigned,
00075 `is_shareable` smallint(1) unsigned NOT NULL default '0',
00076 `link_file` varchar(255) NOT NULL default '',
00077 `sample_file` varchar(255) NOT NULL default '',
00078 PRIMARY KEY (`link_id`),
00079 KEY `DOWNLODABLE_LINK_PRODUCT` (`product_id`),
00080 KEY `DOWNLODABLE_LINK_PRODUCT_SORT_ORDER` (`product_id` , `sort_order`)
00081 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00082 ");
00083
00084 $conn->addConstraint(
00085 'FK_DOWNLODABLE_LINK_PRODUCT', $installer->getTable('downloadable/link'), 'product_id', $installer->getTable('catalog/product'), 'entity_id'
00086 );
00087
00088 $installer->run("
00089 CREATE TABLE `{$installer->getTable('downloadable/link_title')}` (
00090 `title_id` int(10) unsigned NOT NULL auto_increment,
00091 `link_id` int(10) unsigned NOT NULL default '0',
00092 `store_id` smallint(5) unsigned NOT NULL default '0',
00093 `title` varchar(255) NOT NULL default '',
00094 PRIMARY KEY (`title_id`),
00095 KEY `DOWNLOADABLE_LINK_TITLE_LINK` (`link_id`),
00096 KEY `DOWNLOADABLE_LINK_TITLE_STORE` (`store_id`)
00097 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00098 ");
00099
00100 $conn->addConstraint(
00101 'FK_DOWNLOADABLE_LINK_TITLE_LINK', $installer->getTable('downloadable/link_title'), 'link_id', $installer->getTable('downloadable/link'), 'link_id'
00102 );
00103 $conn->addConstraint(
00104 'FK_DOWNLOADABLE_LINK_TITLE_STORE', $installer->getTable('downloadable/link_title'), 'store_id', $installer->getTable('core/store'), 'store_id'
00105 );
00106
00107 $installer->run("
00108 CREATE TABLE `{$installer->getTable('downloadable/link_price')}` (
00109 `price_id` int(10) unsigned NOT NULL auto_increment,
00110 `link_id` int(10) unsigned NOT NULL default '0',
00111 `website_id` smallint(5) unsigned NOT NULL default '0',
00112 `price` decimal(12,4) NOT NULL default '0.0000',
00113 PRIMARY KEY (`price_id`),
00114 KEY `DOWNLOADABLE_LINK_PRICE_LINK` (`link_id`),
00115 KEY `DOWNLOADABLE_LINK_PRICE_WEBSITE` (`website_id`)
00116 ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
00117 ");
00118
00119 $conn->addConstraint(
00120 'FK_DOWNLOADABLE_LINK_PRICE_LINK', $installer->getTable('downloadable/link_price'), 'link_id', $installer->getTable('downloadable/link'), 'link_id'
00121 );
00122 $conn->addConstraint(
00123 'FK_DOWNLOADABLE_LINK_PRICE_WEBSITE', $installer->getTable('downloadable/link_price'), 'website_id', $installer->getTable('core/website'), 'website_id'
00124 );
00125
00126 $installer->endSetup();