Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- php bin/magento setup:upgrade
- namespace ScandesignsProductTypeSetup;
- use MagentoFrameworkSetupUpgradeSchemaInterface;
- use MagentoFrameworkSetupModuleContextInterface;
- use MagentoFrameworkSetupSchemaSetupInterface;
- class UpgradeSchema implements UpgradeSchemaInterface
- {
- public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
- {
- if (version_compare($context->getVersion(), '2.0.1') < 0) {
- $setup->startSetup();
- $setup->getConnection()->addColumn(
- $setup->getTable('sales_order_item'),
- 'product_custom_type',
- [
- 'type' => MagentoFrameworkDBDdlTable::TYPE_STRING,
- 'length' => '256',
- 'nullable' => false,
- 'default' => '',
- 'comment' => 'product custom type'
- ]
- );
- $setup->endSetup();
- }
- }
- }
- <?php
- namespace ScandesignsProductTypeSetup;
- use MagentoFrameworkSetupUpgradeSchemaInterface;
- use MagentoFrameworkSetupModuleContextInterface;
- use MagentoFrameworkSetupSchemaSetupInterface;
- use MagentoFrameworkDBDdlTable;
- class UpgradeSchema implements UpgradeSchemaInterface
- {
- public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
- {
- $installer = $setup;
- $installer->startSetup();
- $connection = $installer->getConnection();
- if (version_compare($context->getVersion(), '2.0.1') < 0) {
- $connection->addColumn(
- $installer->getTable('sales_order_item'),
- 'product_custom_type',
- [
- 'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
- 'length' => 256,
- 'nullable' => false,
- 'default' => '',
- 'comment' => 'product custom type'
- ]
- );
- }
- $installer->endSetup();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement