Skip to content

Commit

Permalink
Merge pull request #26 from experius/feature/add-index-for-performance
Browse files Browse the repository at this point in the history
[PERFORMANCE] Added index to the experius_page_not_found
  • Loading branch information
lewisvoncken authored Sep 18, 2020
2 parents f8bf918 + b72738a commit 03d8e71
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace Experius\PageNotFound\Setup;

use Magento\Framework\DB\Adapter\AdapterInterface;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;

class UpgradeSchema implements UpgradeSchemaInterface
{

/**
* {@inheritdoc}
*/
public function upgrade(
SchemaSetupInterface $setup,
ModuleContextInterface $context
) {
$setup->startSetup();
if (version_compare($context->getVersion(), "1.0.2", "<")) {
$this->addIndexesToTables($setup);
}
$setup->endSetup();
}

public function addIndexesToTables($setup)
{
$setup->getConnection()->query("ALTER TABLE `{$setup->getTable('experius_page_not_found')}` ADD INDEX `EXPERIUS_PAGE_NOT_FOUND_FROM_URL` (`from_url`(255));");
}
}
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" ?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Experius_PageNotFound" setup_version="1.0.1"/>
<module name="Experius_PageNotFound" setup_version="1.0.2"/>
</config>

0 comments on commit 03d8e71

Please sign in to comment.