Skip to content

Newsletter\Model\Subscriber::loadByEmail() does not use MySQL index #13033

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just have a look through the styles please.

Feedback from our tests


FILE: ...LE1/magento2/app/code/Magento/Newsletter/Setup/UpgradeSchema.php
----------------------------------------------------------------------
FOUND 4 ERRORS AFFECTING 4 LINES
----------------------------------------------------------------------
  2 | ERROR | [x] There must be one blank line after the namespace
    |       |     declaration
  7 | ERROR | [x] There must be one blank line after the last USE
    |       |     statement; 0 found;
 11 | ERROR | [x] Expected 1 space before "UpgradeSchemaInterface"; 2
    |       |     found
 37 | ERROR | [x] Expected 1 newline at end of file; 0 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 4 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

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