Skip to content

Commit 1d4873b

Browse files
author
Yuriy Denyshchenko
committed
MAGETWO-55598: Portdown MAGETWO-54787 down to M2.1.x branch
1 parent 0530a78 commit 1d4873b

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

app/code/Magento/Sales/Setup/InstallSchema.php

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,12 +3216,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
32163216
'12,4',
32173217
[],
32183218
'Grand Total'
3219-
)->addColumn(
3220-
'base_grand_total',
3221-
\Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
3222-
'12,4',
3223-
[],
3224-
'Base Grand Total'
32253219
)->addColumn(
32263220
'created_at',
32273221
\Magento\Framework\DB\Ddl\Table::TYPE_TIMESTAMP,
@@ -3240,9 +3234,6 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
32403234
)->addIndex(
32413235
$installer->getIdxName('sales_invoice_grid', ['grand_total']),
32423236
['grand_total']
3243-
)->addIndex(
3244-
$installer->getIdxName('sales_invoice_grid', ['base_grand_total']),
3245-
['base_grand_total']
32463237
)->addIndex(
32473238
$installer->getIdxName('sales_invoice_grid', ['order_id']),
32483239
['order_id']

app/code/Magento/Sales/Setup/UpgradeSchema.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Magento\Framework\Setup\UpgradeSchemaInterface;
88
use Magento\Framework\Setup\ModuleContextInterface;
99
use Magento\Framework\Setup\SchemaSetupInterface;
10+
use Magento\Framework\DB\Adapter\AdapterInterface;
1011

1112
/**
1213
* @codeCoverageIgnore
@@ -53,5 +54,43 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
5354

5455
$installer->endSetup();
5556
}
57+
if (version_compare($context->getVersion(), '2.0.3', '<')) {
58+
$this->addColumnBaseGrandTotal($installer);
59+
$this->addIndexBaseGrandTotal($installer);
60+
}
61+
}
62+
63+
/**
64+
* @param SchemaSetupInterface $installer
65+
* @return void
66+
*/
67+
private function addColumnBaseGrandTotal(SchemaSetupInterface $installer)
68+
{
69+
$connection = $installer->getConnection();
70+
$connection->addColumn(
71+
$installer->getTable('sales_invoice_grid'),
72+
'base_grand_total',
73+
[
74+
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_DECIMAL,
75+
'nullable' => true,
76+
'length' => '12,4',
77+
'comment' => 'Base Grand Total',
78+
'after' => 'grand_total'
79+
]
80+
);
81+
}
82+
83+
/**
84+
* @param SchemaSetupInterface $installer
85+
* @return void
86+
*/
87+
private function addIndexBaseGrandTotal(SchemaSetupInterface $installer)
88+
{
89+
$connection = $installer->getConnection();
90+
$connection->addIndex(
91+
$installer->getTable('sales_invoice_grid'),
92+
$installer->getIdxName('sales_invoice_grid', ['base_grand_total']),
93+
['base_grand_total']
94+
);
5695
}
5796
}

app/code/Magento/Sales/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Sales" setup_version="2.0.2">
9+
<module name="Magento_Sales" setup_version="2.0.3">
1010
<sequence>
1111
<module name="Magento_Rule"/>
1212
<module name="Magento_Catalog"/>

0 commit comments

Comments
 (0)