Last active
September 19, 2018 20:36
-
-
Save sivaschenko/ff1e9e8f90f082b8d3e83415aa63082f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace YourNamespace\YourModule\Setup; | |
use Magento\Framework\Setup\ModuleContextInterface; | |
use Magento\Framework\Setup\ModuleDataSetupInterface; | |
use Magento\Framework\Setup\UpgradeDataInterface; | |
class UpgradeData implements UpgradeDataInterface | |
{ | |
/** | |
* {@inheritdoc} | |
*/ | |
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | |
{ | |
$setup->startSetup(); | |
if (version_compare($context->getVersion(), '1.0.1', '<')) { | |
$connection = $setup->getConnection(); | |
$grid = $setup->getTable('sales_order_grid'); | |
$affiliate = $setup->getTable('affiliate'); | |
$connection->query( | |
$connection->updateFromSelect( | |
$connection->select() | |
->join( | |
$affiliate, | |
sprintf('%s.entity_id = %s.order_id', $grid, $affiliate), | |
'affiliate_information' | |
), | |
$grid | |
) | |
); | |
} | |
$setup->endSetup(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment