I am getting this error in UpgradeSchema. I have added one column in these core tables, functionalities are working good. According to coding standard it shows warning message.
----------------------------------------------------------------------
60 | WARNING | Modification of magento database core table
| | 'sales_order'
78 | WARNING | Modification of magento database core table
| | 'sales_order_grid'
----------------------------------------------------------------------
I have attached my code below
<?php
namespace frontname\modulename\Setup;
use Magento\Framework\Setup\UpgradeSchemaInterface;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\SchemaSetupInterface;
use Magento\Framework\DB\Ddl\Table;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
{
$installer = $setup;
$customerGroupTable = $setup->getConnection()->describeTable($setup->getTable('customer_group'));
$customerGroupIdType = $customerGroupTable['customer_group_id']['DATA_TYPE'] == 'int'
? \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER : $customerGroupTable['customer_group_id']['DATA_TYPE'];
$installer->startSetup();
if (version_compare($context->getVersion(), '2.0.1') < 0) {
$eavTable = $installer->getTable('sales_order');
$columns = [
'is_wallet_quote' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
'nullable' => false,
'comment' => 'Is this quote for wallet?',
],
'holded_quote_id' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
'nullable' => false,
'comment' => 'Holded Quote Id',
],
];
$connection = $installer->getConnection();
foreach ($columns as $name => $definition) {
$connection->addColumn($eavTable, $name, $definition);
}
$eavTable = $installer->getTable('sales_order_grid');
$columns = [
'is_wallet_quote' => [
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
'nullable' => false,
'comment' => 'Is this quote for wallet?',
],
];
$connection = $installer->getConnection();
foreach ($columns as $name => $definition) {
$connection->addColumn($eavTable, $name, $definition);
}
}
$installer->endSetup();
}
}
Anyone have any idea about this? Thanks in Advance