diff --git a/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php b/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php
index 7ba339a8703e..8ae27b897319 100644
--- a/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php
+++ b/vendor/magento/module-company/Setup/Patch/Data/SetCompanyForStructure.php
@@ -68,11 +68,11 @@ public function apply()
$adminStructureIds = $this->moduleDataSetup->getConnection()->fetchAssoc($adminSelect);
foreach ($companies as $company) {
if (isset($adminStructureIds[$company['super_user_id']]['structure_id'])) {
+ $structureId = (int)$adminStructureIds[$company['super_user_id']]['structure_id'];
$this->moduleDataSetup->getConnection()->update(
$this->moduleDataSetup->getTable('company_structure'),
- ['company_id' => $company['entity_id']],
- ['path REGEXP ?' =>
- '^' . $adminStructureIds[$company['super_user_id']]['structure_id'] . '(/.+)?$']
+ ['company_id' => (int)$company['entity_id']],
+ ['path LIKE \'' . $structureId . '/%\' OR path = \'' . $structureId . '\'']
);
}
}
diff --git a/vendor/magento/module-company/etc/db_schema.xml b/vendor/magento/module-company/etc/db_schema.xml
index 7e0780146900..f50037328736 100644
--- a/vendor/magento/module-company/etc/db_schema.xml
+++ b/vendor/magento/module-company/etc/db_schema.xml
@@ -113,6 +113,9 @@