Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace vendor\module\Setup;
- use Magento\Framework\Setup\InstallSchemaInterface;
- use Magento\Framework\Setup\ModuleContextInterface;
- use Magento\Framework\Setup\SchemaSetupInterface;
- class InstallSchema implements InstallSchemaInterface
- {
- /**
- * {@inheritdoc}
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
- */
- public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
- {
- $installer = $setup;
- $installer->startSetup();
- /* While module install, creates column in sales_order_grid table */
- $eavTable = $installer->getTable('sales_order_grid');
- $columns = [
- 'coupon_code' => [
- 'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
- 'nullable' => true,
- 'comment' => 'Coupon Code',
- ],
- ];
- $connection = $installer->getConnection();
- foreach ($columns as $name => $definition) {
- $connection->addColumn($eavTable, $name, $definition);
- }
- $installer->endSetup();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement