Skip to content

Commit

Permalink
MAGETWO-86297: Fix vault_payment_token install script type where colu…
Browse files Browse the repository at this point in the history
…mn defaults were not set #12965
  • Loading branch information
ishakhsuvarov authored Jan 10, 2018
2 parents 6ec1fe8 + bf6a8ca commit bb53c2d
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/Vault/Setup/InstallSchema.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
'is_active',
Table::TYPE_BOOLEAN,
null,
['nullable' => false, 'dafault' => true],
['nullable' => false, 'default' => true],
'Is active flag'
)->addColumn(
'is_visible',
Table::TYPE_BOOLEAN,
null,
['nullable' => false, 'dafault' => true],
['nullable' => false, 'default' => true],
'Is visible flag'
)->addIndex(
$setup->getIdxName(
Expand Down
51 changes: 51 additions & 0 deletions app/code/Magento/Vault/Setup/UpgradeSchema.php
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'
]
);
}
}
}
2 changes: 1 addition & 1 deletion app/code/Magento/Vault/etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_Vault" setup_version="2.0.2">
<module name="Magento_Vault" setup_version="2.0.3">
<sequence>
<module name="Magento_Sales"/>
<module name="Magento_Store"/>
Expand Down

0 comments on commit bb53c2d

Please sign in to comment.