Skip to content

Commit

Permalink
Newsletter Model Subcriber LoadByEmail does not
Browse files Browse the repository at this point in the history
- Use MYSQL index
- Add an Mysql Index key via upgrade Schema
- files  add  at app/code/Magento/Newsletter/Setup/UpgradeScheme.php
- Modified at app/code/Magento/Newsletter/etc/module.xml
  • Loading branch information
devamitbera committed Jan 7, 2018
1 parent 816ec39 commit 7559783
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
37 changes: 37 additions & 0 deletions app/code/Magento/Newsletter/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
namespace Magento\Newsletter\Setup;


use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\Setup\UpgradeSchemaInterface;
/**
* Upgrade the Newsletter module DB scheme
*/
class UpgradeSchema implements UpgradeSchemaInterface
{

/**
* Upgrades DB schema for a module
*
* @param SchemaSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
*/
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$setup->startSetup();

if (version_compare($context->getVersion(), '2.0.1', '<')) {
$connection = $setup->getConnection();

$connection->addIndex(
$setup->getTable('newsletter_subscriber'),
$setup->getIdxName('newsletter_subscriber', ['subscriber_email']),
['subscriber_email']
);
}

$setup->endSetup();
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Newsletter/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Newsletter" setup_version="2.0.0">
<module name="Magento_Newsletter" setup_version="2.0.1">
<sequence>
<module name="Magento_Store"/>
<module name="Magento_Customer"/>
Expand Down

0 comments on commit 7559783

Please sign in to comment.