This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Run the below sql command to find products in url_rewrite on MariaDB which does not have same entity_id as target_path | |
SELECT regexp_substr(`target_path`, '([0-9]+)'), `target_path` FROM `url_rewrite` WHERE `target_path` REGEXP | |
'/id/([0-9]+)' AND `entity_type` = 'product'; | |
#Below update command will update differ entity_id to same as target_path product_id on MariaDB | |
UPDATE `url_rewrite` AS `master` | |
JOIN `url_rewrite` AS `child` ON `master`.`entity_id` | |
NOT LIKE concat("%/id/", `master`.`entity_id`,"%") AND `master`.`entity_type`='product' |