Skip to content

Commit 3efdadd

Browse files
committed
add indexes
1 parent 91d2ac3 commit 3efdadd

2 files changed

Lines changed: 54 additions & 2 deletions

File tree

app/code/community/EcomDev/UrlRewrite/etc/config.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<config>
2121
<modules>
2222
<EcomDev_UrlRewrite>
23-
<version>0.2.1</version>
23+
<version>0.2.2</version>
2424
</EcomDev_UrlRewrite>
2525
</modules>
2626
<global>
@@ -104,4 +104,4 @@
104104
</modules>
105105
</suite>
106106
</phpunit>
107-
</config>
107+
</config>
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
* Alternative Url Rewrite Indexer
4+
*
5+
* NOTICE OF LICENSE
6+
*
7+
* This source file is subject to the Open Software License (OSL 3.0)
8+
* that is bundled with this package in the file LICENSE.txt.
9+
* It is also available through the world-wide-web at this URL:
10+
* http://opensource.org/licenses/osl-3.0.php
11+
*
12+
* @category EcomDev
13+
* @package EcomDev_UrlRewrite
14+
* @copyright Copyright (c) 2011 EcomDev BV (http://www.ecomdev.org)
15+
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
16+
* @author Ivan Chepurnyi <ivan.chepurnyi@ecomdev.org>
17+
*/
18+
19+
/* @var $this Mage_Core_Model_Resource_Setup */
20+
$this->startSetup();
21+
22+
$indexes = $this->getConnection()->getIndexList($this->getTable('ecomdev_urlrewrite/product_relation'));
23+
$indexName = $this->getIdxName(
24+
'ecomdev_urlrewrite/product_relation',
25+
['store_id', 'category_id'],
26+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
27+
);
28+
if (!isset($indexes[$indexName])) {
29+
$this->getConnection()->addIndex(
30+
$this->getTable('ecomdev_urlrewrite/product_relation'),
31+
$indexName,
32+
['store_id', 'category_id'],
33+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
34+
);
35+
}
36+
37+
$indexes = $this->getConnection()->getIndexList($this->getTable('ecomdev_urlrewrite/product_relation'));
38+
$indexName = $this->getIdxName(
39+
'ecomdev_urlrewrite/product_relation',
40+
['store_id', 'product_id'],
41+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
42+
);
43+
if (!isset($indexes[$indexName])) {
44+
$this->getConnection()->addIndex(
45+
$this->getTable('ecomdev_urlrewrite/product_relation'),
46+
$indexName,
47+
['store_id', 'product_id'],
48+
Varien_Db_Adapter_Interface::INDEX_TYPE_UNIQUE
49+
);
50+
}
51+
52+
$this->endSetup();

0 commit comments

Comments
 (0)