Last active
November 23, 2018 08:44
-
-
Save sbruggmann/e34bb997f0190da1effb0a765defc429 to your computer and use it in GitHub Desktop.
Move large Neos NodeTree to new Parent with MySQL
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
START TRANSACTION; | |
SET NAMES utf8 COLLATE utf8_unicode_ci; | |
alter database YOUR_DATABASE default character set utf8; | |
alter database YOUR_DATABASE default collate utf8_unicode_ci; | |
SET @whereLikePath = '%node-57fe3793425c0%'; | |
SET @oldPath = '/sites/theme/node-57fe3793425c0'; | |
SET @newPath = '/sites/theme/node-nm3vs6pu3hzod/node-57fe3793425c0'; | |
SET @oldParentpath = '/sites/theme'; | |
SET @newParentpath = '/sites/theme/node-nm3vs6pu3hzod'; | |
UPDATE YOUR_DATABASE.neos_contentrepository_domain_model_nodedata n SET n.`path` = REPLACE(n.`path`, @oldPath, @newPath), n.parentpath = REPLACE(n.parentpath, @oldParentpath, @newParentpath), n.pathhash = MD5(n.`path`), n.parentpathhash = MD5(n.parentpath) WHERE n.`path` like @whereLikePath; | |
COMMIT; |
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
START TRANSACTION; | |
SET NAMES utf8 COLLATE utf8_unicode_ci; | |
alter database YOUR_DATABASE default character set utf8; | |
alter database YOUR_DATABASE default collate utf8_unicode_ci; | |
SET @whereLikePath = '%node-q8ddaajoua2j3%'; | |
SET @oldName = 'node-q8ddaajoua2j3'; | |
SET @newName = 'node-5c1t64seyao71'; | |
UPDATE YOUR_DATABASE.neos_contentrepository_domain_model_nodedata n SET n.`path` = REPLACE(n.`path`, @oldName, @newName), n.parentpath = REPLACE(n.parentpath, @oldName, @newName), n.pathhash = MD5(n.`path`), n.parentpathhash = MD5(n.parentpath) WHERE n.`path` like @whereLikePath; | |
COMMIT; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment