Skip to content

Commit 029aa1f

Browse files
committed
Merge remote-tracking branch 'origin/AC-14424' into spartans_pr_25062025
2 parents ff71237 + 7c24a42 commit 029aa1f

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

app/code/Magento/Indexer/etc/db_schema.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0"?>
22
<!--
33
/**
4-
* Copyright © Magento, Inc. All rights reserved.
5-
* See COPYING.txt for license details.
4+
* Copyright 2018 Adobe
5+
* All Rights Reserved.
66
*/
77
-->
88
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -29,7 +29,7 @@
2929
<column xsi:type="varchar" name="mode" nullable="true" length="16" default="disabled" comment="View Mode"/>
3030
<column xsi:type="varchar" name="status" nullable="true" length="16" default="idle" comment="View Status"/>
3131
<column xsi:type="datetime" name="updated" on_update="false" nullable="true" comment="View updated time"/>
32-
<column xsi:type="int" name="version_id" unsigned="true" nullable="true" identity="false"
32+
<column xsi:type="bigint" name="version_id" unsigned="true" nullable="true" identity="false"
3333
comment="View Version ID"/>
3434
<constraint xsi:type="primary" referenceId="PRIMARY">
3535
<column name="state_id"/>

lib/internal/Magento/Framework/Mview/View/Changelog.php

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function create()
126126
$changelogTableName
127127
)->addColumn(
128128
self::VERSION_ID_COLUMN_NAME,
129-
\Magento\Framework\DB\Ddl\Table::TYPE_INTEGER,
129+
\Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
130130
null,
131131
['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
132132
'Version ID'
@@ -149,6 +149,7 @@ public function create()
149149
} else {
150150
// change the charset to utf8mb4
151151
$getTableSchema = $this->connection->getCreateTable($changelogTableName) ?? '';
152+
$this->changeVersionIdToBigInt($getTableSchema, $changelogTableName);
152153
if (preg_match('/\b('. self::OLDCHARSET .')\b/', $getTableSchema)) {
153154
$charset = $this->columnConfig->getDefaultCharset();
154155
$collate = $this->columnConfig->getDefaultCollation();
@@ -164,6 +165,32 @@ public function create()
164165
}
165166
}
166167

168+
/**
169+
* Change version_id from int to bigint
170+
*
171+
* @param string $getTableSchema
172+
* @param string $changelogTableName
173+
* @return void
174+
*/
175+
private function changeVersionIdToBigInt(string $getTableSchema, string $changelogTableName): void
176+
{
177+
$pattern = '/`version_id`\s+int\b/i';
178+
if (preg_match($pattern, $getTableSchema)) {
179+
$this->connection->modifyColumn(
180+
$changelogTableName,
181+
self::VERSION_ID_COLUMN_NAME,
182+
[
183+
'type' => \Magento\Framework\DB\Ddl\Table::TYPE_BIGINT,
184+
'nullable' => false,
185+
'identity' => true,
186+
'unsigned' => true,
187+
'primary' => true,
188+
'comment' => 'Version ID'
189+
]
190+
);
191+
}
192+
}
193+
167194
/**
168195
* Retrieve additional column data
169196
*

0 commit comments

Comments
 (0)