-
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.
MAGETWO-86297: Fix vault_payment_token install script type where colu…
…mn defaults were not set #12965
- Loading branch information
Showing
3 changed files
with
54 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Vault\Setup; | ||
|
||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\SchemaSetupInterface; | ||
use Magento\Framework\Setup\UpgradeSchemaInterface; | ||
use Magento\Framework\DB\Ddl\Table; | ||
|
||
/** | ||
* Upgrade the Vault module DB scheme | ||
*/ | ||
class UpgradeSchema implements UpgradeSchemaInterface | ||
{ | ||
/** | ||
* @inheritdoc | ||
*/ | ||
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$setup->startSetup(); | ||
if (version_compare($context->getVersion(), '2.0.3', '<')) { | ||
$this->upgradeTokenTableDefaultValues($setup); | ||
} | ||
$setup->endSetup(); | ||
} | ||
|
||
/** | ||
* @param SchemaSetupInterface $setup | ||
* @return void | ||
*/ | ||
private function upgradeTokenTableDefaultValues(SchemaSetupInterface $setup) | ||
{ | ||
$columns = ['is_active', 'is_visible']; | ||
|
||
foreach ($columns as $columnName) { | ||
$setup->getConnection()->modifyColumn( | ||
$setup->getTable(InstallSchema::PAYMENT_TOKEN_TABLE), | ||
$columnName, | ||
[ | ||
'type' => Table::TYPE_BOOLEAN, | ||
'nullable' => false, | ||
'default' => '1' | ||
] | ||
); | ||
} | ||
} | ||
} |
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