Skip to content

Commit

Permalink
⏫ Forwardport of #13033 to 2.3-develop branch
Browse files Browse the repository at this point in the history
Applied pull request patch https://github.com/magento/magento2/pull/13033.patch (created by @devamitbera) based on commit(s):
  1. 7559783
  2. b853497
  3. be8b258

Fixed GitHub Issues in 2.3-develop branch:
  - #12787: Newsletter\Model\Subscriber::loadByEmail() does not use MySQL index (reported by @schmengler)
  • Loading branch information
magento-engcom-team committed Jan 24, 2018
1 parent 8e77e2f commit 54bc3a1
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
36 changes: 36 additions & 0 deletions app/code/Magento/Newsletter/Setup/UpgradeSchema.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
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
{
/**
* {@inheritdoc}
*/
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 54bc3a1

Please sign in to comment.