This repository was archived by the owner on Jul 11, 2023. It is now read-only.
Description UpgradeData script failing on Magento 2 enterprise.
Fix:
diff --git a/Setup/UpgradeData.php b/Setup/UpgradeData.php
index db4f834..8b0f43c 100644
--- a/Setup/UpgradeData.php
+++ b/Setup/UpgradeData.php
@@ -319,7 +319,6 @@ class UpgradeData implements UpgradeDataInterface
protected function setDefaultIsImportedValuesForExistingCategories(ModuleDataSetupInterface $setup)
{
- $existingCategoryIds = $this->categoryCollection->getAllIds();
$isImportedAttributeId = $this->eavAttribute->getIdByCode(Category::ENTITY, InstallData::IS_IMPORTED);
if (empty($existingCategoryIds)) {
@@ -328,8 +327,17 @@ class UpgradeData implements UpgradeDataInterface
$connection = $setup->getConnection();
$tableName = $setup->getTable('catalog_category_entity_int');
- $columnName = 'entity_id';
- $fkColumnName = $connection->tableColumnExists($tableName, $columnName) ? $columnName : 'row_id';
+ $hasRowId = $connection->tableColumnExists($tableName, 'row_id');
+ $fkColumnName = $hasRowId ? 'row_id' : 'entity_id';
+ $existingCategoryIds = [];
+
+ if ($hasRowId) {
+ $existingCategoryIds = $this->categoryCollection
+ ->addFieldToSelect('row_id')
+ ->getColumnValues('row_id');
+ } else {
+ $existingCategoryIds = $this->categoryCollection->getAllIds();
+ }
$data = [];
Reactions are currently unavailable