Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.93 KB | None | 0 0
  1. php bin/magento setup:upgrade
  2.  
  3. namespace ScandesignsProductTypeSetup;
  4.  
  5. use MagentoFrameworkSetupUpgradeSchemaInterface;
  6. use MagentoFrameworkSetupModuleContextInterface;
  7. use MagentoFrameworkSetupSchemaSetupInterface;
  8.  
  9. class UpgradeSchema implements UpgradeSchemaInterface
  10. {
  11. public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
  12. {
  13. if (version_compare($context->getVersion(), '2.0.1') < 0) {
  14. $setup->startSetup();
  15. $setup->getConnection()->addColumn(
  16. $setup->getTable('sales_order_item'),
  17. 'product_custom_type',
  18. [
  19. 'type' => MagentoFrameworkDBDdlTable::TYPE_STRING,
  20. 'length' => '256',
  21. 'nullable' => false,
  22. 'default' => '',
  23. 'comment' => 'product custom type'
  24. ]
  25. );
  26. $setup->endSetup();
  27. }
  28. }
  29. }
  30.  
  31. <?php
  32.  
  33. namespace ScandesignsProductTypeSetup;
  34.  
  35. use MagentoFrameworkSetupUpgradeSchemaInterface;
  36. use MagentoFrameworkSetupModuleContextInterface;
  37. use MagentoFrameworkSetupSchemaSetupInterface;
  38. use MagentoFrameworkDBDdlTable;
  39.  
  40. class UpgradeSchema implements UpgradeSchemaInterface
  41. {
  42. public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
  43. {
  44. $installer = $setup;
  45. $installer->startSetup();
  46. $connection = $installer->getConnection();
  47.  
  48. if (version_compare($context->getVersion(), '2.0.1') < 0) {
  49. $connection->addColumn(
  50. $installer->getTable('sales_order_item'),
  51. 'product_custom_type',
  52. [
  53. 'type' => MagentoFrameworkDBDdlTable::TYPE_TEXT,
  54. 'length' => 256,
  55. 'nullable' => false,
  56. 'default' => '',
  57. 'comment' => 'product custom type'
  58. ]
  59. );
  60. }
  61. $installer->endSetup();
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement