|
| 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