-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #255 from magento-troll/MAGETWO-40061
[Troll] MAGETWO-40061
- Loading branch information
Showing
9 changed files
with
64 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
/** | ||
* Copyright © 2015 Magento. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\CatalogRule\Setup; | ||
|
||
use Magento\Framework\Setup\UpgradeSchemaInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
|
||
/** | ||
* Upgrade the CatalogRule module DB scheme | ||
*/ | ||
class UpgradeSchema implements UpgradeSchemaInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$setup->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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters