Skip to content

Commit

Permalink
MAGETWO-87551: Convert existing data install/upgrade scripts
Browse files Browse the repository at this point in the history
- refactoring of infra to use setup
  • Loading branch information
rganin committed Feb 12, 2018
1 parent d9edf1e commit 6368e1e
Show file tree
Hide file tree
Showing 102 changed files with 236 additions and 160 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

use Magento\Analytics\Model\Config\Backend\Enabled\SubscriptionHandler;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Setup\Model\Patch\DataPatchInterface;
use Magento\Setup\Model\Patch\PatchVersionInterface;

Expand All @@ -19,27 +20,27 @@
class PrepareInitialConfig implements DataPatchInterface, PatchVersionInterface
{
/**
* @var ResourceConnection
* @var ModuleDataSetupInterface
*/
private $resourceConnection;
private $moduleDataSetup;

/**
* PrepareInitialConfig constructor.
* @param ResourceConnection $resourceConnection
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ResourceConnection $resourceConnection
ModuleDataSetupInterface $moduleDataSetup
) {
$this->resourceConnection = $resourceConnection;
$this->moduleDataSetup = $moduleDataSetup;
}

/**
* {@inheritdoc}
*/
public function apply()
{
$this->resourceConnection->getConnection()->insertMultiple(
$this->resourceConnection->getConnection()->getTableName('core_config_data'),
$this->moduleDataSetup->getConnection()->insertMultiple(
$this->moduleDataSetup->getConnection()->getTableName('core_config_data'),
[
[
'scope' => 'default',
Expand All @@ -56,8 +57,8 @@ public function apply()
]
);

$this->resourceConnection->getConnection()->insert(
$this->resourceConnection->getConnection()->getTableName('flag'),
$this->moduleDataSetup->getConnection()->insert(
$this->moduleDataSetup->getConnection()->getTableName('flag'),
[
'flag_code' => SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE,
'state' => 0,
Expand All @@ -78,7 +79,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.2';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.4';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.1.3';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.1.5';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.2';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.3';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.4';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.5';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.7';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.2.2';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.2.1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.2.1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.2.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.3';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.2';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.2.0';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.1';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.4';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.2';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.7';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.11';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static function getDependencies()
/**
* {@inheritdoc}
*/
public function getVersion()
public static function getVersion()
{
return '2.0.0';
}
Expand Down
Loading

0 comments on commit 6368e1e

Please sign in to comment.