startSetup(); if (version_compare($context->getVersion(), '2.0.1', '<')) { $this->removeSubProductDiscounts($setup); } $setup->endSetup(); } /** * Remove Sub Product Discounts * @param SchemaSetupInterface $setup * @return void */ private function removeSubProductDiscounts(SchemaSetupInterface $setup) { $connection = $setup->getConnection(); $data = [ 'catalogrule' => [ 'sub_is_enable', 'sub_simple_action', 'sub_discount_amount', ], 'catalogrule_product' => [ 'sub_simple_action', 'sub_discount_amount', ], ]; foreach ($data as $table => $fields) { foreach ($fields as $field) { $connection->dropColumn($setup->getTable($table), $field); } } } }