Skip to content

Commit

Permalink
MAGETWO-87551: Convert existing data install/upgrade scripts
Browse files Browse the repository at this point in the history
- Analytics
- Authorization
- Braintree
- Bundle
- Eav (EavSetup refactoring only)
  • Loading branch information
rganin committed Feb 9, 2018
1 parent 14a002e commit 4236163
Show file tree
Hide file tree
Showing 16 changed files with 469 additions and 1,305 deletions.
52 changes: 0 additions & 52 deletions app/code/Magento/Analytics/Setup/InstallData.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,38 @@
namespace Magento\Analytics\Setup\Patch;

use Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;


/**
* Patch is mechanism, that allows to do atomic upgrade data changes
* Initial patch.
*
* @package Magento\Analytics\Setup\Patch
*/
class PatchInitial implements \Magento\Setup\Model\Patch\DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* PatchInitial constructor.
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup
) {

$this->moduleDataSetup = $moduleDataSetup;
}

/**
* Do Upgrade
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
* {@inheritdoc}
*/
public function apply(ModuleDataSetupInterface $setup)
public function apply()
{
$setup->getConnection()->insertMultiple(
$setup->getTable('core_config_data'),
$this->moduleDataSetup->getConnection()->insertMultiple(
$this->moduleDataSetup->getTable('core_config_data'),
[
[
'scope' => 'default',
Expand All @@ -45,8 +55,8 @@ public function apply(ModuleDataSetupInterface $setup)
]
);

$setup->getConnection()->insert(
$setup->getTable('flag'),
$this->moduleDataSetup->getConnection()->insert(
$this->moduleDataSetup->getTable('flag'),
[
'flag_code' => SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE,
'state' => 0,
Expand All @@ -57,23 +67,26 @@ public function apply(ModuleDataSetupInterface $setup)
}

/**
* Do Revert
*
* @param ModuleDataSetupInterface $setup
* @param ModuleContextInterface $context
* @return void
* {@inheritdoc}
*/
public function revert(ModuleDataSetupInterface $setup)
public static function getDependencies()
{
return [];
}

/**
* @inheritdoc
* {@inheritdoc}
*/
public function isDisabled()
public function getVersion()
{
return false;
return '2.0.0';
}


/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
}
101 changes: 0 additions & 101 deletions app/code/Magento/Authorization/Setup/InstallData.php

This file was deleted.

68 changes: 68 additions & 0 deletions app/code/Magento/Authorization/Setup/Patch/InitializeAuthRoles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Authorization\Setup\Patch;

use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Setup\Model\Patch\DataPatchInterface;
use Magento\Setup\Model\Patch\VersionedDataPatch;

/**
* Initial patch.
*
* @package Magento\Analytics\Setup\Patch
*/
class PrepareInitialConfig implements DataPatchInterface, VersionedDataPatch
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* PatchInitial constructor.
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup
) {

$this->moduleDataSetup = $moduleDataSetup;
}

/**
* {@inheritdoc}
*/
public function apply()
{


}

/**
* {@inheritdoc}
*/
public static function getDependencies()
{
return [];
}

/**
* {@inheritdoc}
*/
public function getVersion()
{
return '2.0.0';
}

/**
* {@inheritdoc}
*/
public function getAliases()
{
return [];
}
}
Loading

0 comments on commit 4236163

Please sign in to comment.