This commit is contained in:
2026-09-15 10:26:34 +08:00
commit ecf36afa56
10493 changed files with 1404888 additions and 0 deletions
@@ -0,0 +1,31 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Setup/Declaration/Schema/etc/schema.xsd">
<table name="reference_table" resource="default">
<column xsi:type="tinyint" name="tinyint_ref" padding="7" nullable="false" identity="true" unsigned="false"/>
<column xsi:type="int" name="some_integer" default="0" nullable="false" unsigned="false"/>
<column xsi:type="varchar" name="for_patch_testing" comment="For patch testing" />
<constraint xsi:type="primary" referenceId="tinyint_primary">
<column name="tinyint_ref"/>
</constraint>
</table>
<table name="test_table" resource="default">
<!--Columns-->
<column xsi:type="smallint" identity="true" name="smallint" padding="3" nullable="true"/>
<column xsi:type="tinyint" name="tinyint" padding="7" nullable="true" unsigned="false"/>
<column xsi:type="varchar" name="varchar" length="254" nullable="true"/>
<column xsi:type="varbinary" name="varbinary" default="10101" />
<constraint xsi:type="foreign" referenceId="TEST_TABLE_TINYINT_REFERENCE_TABLE_TINYINT_REF"
column="tinyint" table="test_table"
referenceTable="reference_table" referenceColumn="tinyint_ref" onDelete="CASCADE"/>
<constraint xsi:type="primary" referenceId="PRIMARY">
<column name="smallint" />
</constraint>
</table>
</schema>
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestSetupDeclarationModule5" setup_version="1.0.4" />
</config>
@@ -0,0 +1,12 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
use Magento\Framework\Component\ComponentRegistrar;
$registrar = new ComponentRegistrar();
if ($registrar->getPath(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule5') === null) {
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_TestSetupDeclarationModule5', __DIR__);
}
@@ -0,0 +1,10 @@
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Magento_TestSetupDeclarationModule5" />
</config>
@@ -0,0 +1,39 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestSetupDeclarationModule5\Setup;
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
/**
* Class InstallData
* @package Magento\TestSetupDeclarationModule3\Setup
*/
class UpgradeData implements UpgradeDataInterface
{
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
{
$adapter = $setup->getConnection();
$setup->startSetup();
if (version_compare($context->getVersion(), '1.0.2') < 0) {
$adapter->insertArray('reference_table', ['some_integer'], [6, 12, 7]);
}
if (version_compare($context->getVersion(), '1.0.3') < 0) {
$adapter->delete('reference_table', 'some_integer = 7');
}
$setup->endSetup();
}
}
@@ -0,0 +1,72 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestSetupDeclarationModule5\Setup\Patch\Data;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchRevertableInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
/**
* Class SomePatch
* @package Magento\TestSetupDeclarationModule3\Setup
*/
class SomePatch implements
DataPatchInterface,
PatchRevertableInterface,
PatchVersionInterface
{
/**
* @var ResourceConnection
*/
private $resourceConnection;
/**
* IncrementalSomeIntegerPatch constructor.
* @param ResourceConnection $resourceConnection
*/
public function __construct(ResourceConnection $resourceConnection)
{
$this->resourceConnection = $resourceConnection;
}
/**
* @return string
*/
public static function getVersion()
{
return '1.0.5';
}
/**
* @return array
*/
public function getAliases()
{
return [];
}
/**
* @inheritdoc
*/
public function apply()
{
$adapter = $this->resourceConnection->getConnection();
$adapter->insert('test_table', ['varchar' => "_ref", 'varbinary' => 0101010]);
}
public function revert()
{
}
/**
* @return array
*/
public static function getDependencies()
{
return [];
}
}
@@ -0,0 +1,71 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\TestSetupDeclarationModule5\Setup\Patch\Data;
use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Setup\Patch\DataPatchInterface;
use Magento\Framework\Setup\Patch\PatchRevertableInterface;
use Magento\Framework\Setup\Patch\PatchVersionInterface;
/**
* Class SomePatch
* @package Magento\TestSetupDeclarationModule3\Setup
*/
class SomeSkippedPatch implements
DataPatchInterface,
PatchRevertableInterface,
PatchVersionInterface
{
/**
* @var ResourceConnection
*/
private $resourceConnection;
/**
* IncrementalSomeIntegerPatch constructor.
* @param ResourceConnection $resourceConnection
*/
public function __construct(ResourceConnection $resourceConnection)
{
$this->resourceConnection = $resourceConnection;
}
/**
* @return string
*/
public static function getVersion()
{
return '1.0.2';
}
/**
* @return array
*/
public function getAliases()
{
return [];
}
/**
* @inheritdoc
*/
public function apply()
{
throw new \Exception('This patch should be skipped!');
}
public function revert()
{
}
/**
* @return array
*/
public static function getDependencies()
{
return [];
}
}