Skip to content

Commit b62707a

Browse files
ENGCOM-1441: Changed the length of the remote_ip field to store ipv6 addresses #14976
2 parents 066ad39 + 40bab68 commit b62707a

File tree

4 files changed

+66
-22
lines changed

4 files changed

+66
-22
lines changed

app/code/Magento/Quote/Setup/UpgradeSchema.php

Lines changed: 44 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,13 @@ class UpgradeSchema implements UpgradeSchemaInterface
2626
public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $context)
2727
{
2828
$setup->startSetup();
29-
3029
if (version_compare($context->getVersion(), '2.0.1', '<')) {
3130
$setup->getConnection(self::$connectionName)->addIndex(
3231
$setup->getTable('quote_id_mask', self::$connectionName),
3332
$setup->getIdxName('quote_id_mask', ['masked_id'], '', self::$connectionName),
3433
['masked_id']
3534
);
3635
}
37-
3836
if (version_compare($context->getVersion(), '2.0.2', '<')) {
3937
$setup->getConnection(self::$connectionName)->changeColumn(
4038
$setup->getTable('quote_address', self::$connectionName),
@@ -101,25 +99,51 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
10199
);
102100
}
103101
if (version_compare($context->getVersion(), '2.0.7', '<')) {
104-
$connection = $setup->getConnection(self::$connectionName);
105-
$connection->modifyColumn(
106-
$setup->getTable('quote_address', self::$connectionName),
107-
'telephone',
108-
['type' => Table::TYPE_TEXT, 'length' => 255]
109-
)->modifyColumn(
110-
$setup->getTable('quote_address', self::$connectionName),
111-
'fax',
112-
['type' => Table::TYPE_TEXT, 'length' => 255]
113-
)->modifyColumn(
114-
$setup->getTable('quote_address', self::$connectionName),
115-
'region',
116-
['type' => Table::TYPE_TEXT, 'length' => 255]
117-
)->modifyColumn(
118-
$setup->getTable('quote_address', self::$connectionName),
119-
'city',
120-
['type' => Table::TYPE_TEXT, 'length' => 255]
121-
);
102+
$this->expandQuoteAddressFields($setup);
103+
}
104+
if (version_compare($context->getVersion(), '2.0.8', '<')) {
105+
$this->expandRemoteIpField($setup);
122106
}
123107
$setup->endSetup();
124108
}
109+
110+
/**
111+
* @param SchemaSetupInterface $setup
112+
* @return void
113+
*/
114+
private function expandRemoteIpField(SchemaSetupInterface $setup)
115+
{
116+
$connection = $setup->getConnection(self::$connectionName);
117+
$connection->modifyColumn(
118+
$setup->getTable('quote', self::$connectionName),
119+
'remote_ip',
120+
['type' => Table::TYPE_TEXT, 'length' => 45]
121+
);
122+
}
123+
124+
/**
125+
* @param SchemaSetupInterface $setup
126+
* @return void
127+
*/
128+
private function expandQuoteAddressFields(SchemaSetupInterface $setup)
129+
{
130+
$connection = $setup->getConnection(self::$connectionName);
131+
$connection->modifyColumn(
132+
$setup->getTable('quote_address', self::$connectionName),
133+
'telephone',
134+
['type' => Table::TYPE_TEXT, 'length' => 255]
135+
)->modifyColumn(
136+
$setup->getTable('quote_address', self::$connectionName),
137+
'fax',
138+
['type' => Table::TYPE_TEXT, 'length' => 255]
139+
)->modifyColumn(
140+
$setup->getTable('quote_address', self::$connectionName),
141+
'region',
142+
['type' => Table::TYPE_TEXT, 'length' => 255]
143+
)->modifyColumn(
144+
$setup->getTable('quote_address', self::$connectionName),
145+
'city',
146+
['type' => Table::TYPE_TEXT, 'length' => 255]
147+
);
148+
}
125149
}

app/code/Magento/Quote/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Quote" setup_version="2.0.7">
9+
<module name="Magento_Quote" setup_version="2.0.8">
1010
</module>
1111
</config>

app/code/Magento/Sales/Setup/UpgradeSchema.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
106106
]
107107
);
108108
}
109+
if (version_compare($context->getVersion(), '2.0.10', '<')) {
110+
$this->expandRemoteIpField($installer);
111+
}
109112
}
110113

111114
/**
@@ -141,4 +144,21 @@ private function addIndexBaseGrandTotal(SchemaSetupInterface $installer)
141144
['base_grand_total']
142145
);
143146
}
147+
148+
/**
149+
* @param SchemaSetupInterface $installer
150+
* @return void
151+
*/
152+
private function expandRemoteIpField(SchemaSetupInterface $installer)
153+
{
154+
$connection = $installer->getConnection(self::$connectionName);
155+
$connection->modifyColumn(
156+
$installer->getTable('sales_order', self::$connectionName),
157+
'remote_ip',
158+
[
159+
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_TEXT,
160+
'length' => 45
161+
]
162+
);
163+
}
144164
}

app/code/Magento/Sales/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Sales" setup_version="2.0.9">
9+
<module name="Magento_Sales" setup_version="2.0.10">
1010
<sequence>
1111
<module name="Magento_Rule"/>
1212
<module name="Magento_Catalog"/>

0 commit comments

Comments
 (0)