Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sivaschenko/ff1e9e8f90f082b8d3e83415aa63082f to your computer and use it in GitHub Desktop.
Save sivaschenko/ff1e9e8f90f082b8d3e83415aa63082f to your computer and use it in GitHub Desktop.
<?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