@@ -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