Skip to content

Instantly share code, notes, and snippets.

@Sebobo
Created September 13, 2022 08:30
Show Gist options
  • Save Sebobo/199897f35d00eee12e5b2c937bf06fa5 to your computer and use it in GitHub Desktop.
Save Sebobo/199897f35d00eee12e5b2c937bf06fa5 to your computer and use it in GitHub Desktop.
Remove duplicate nodes in a Neos setup with nodes without and with dimensions
UPDATE neos_contentrepository_domain_model_nodedata SET dimensionvalues = '{
"language": {
"0": "de"
}
}' WHERE dimensionvalues = '{}' and path <> '/' and path <> '/sites';
delete t1 FROM neos_contentrepository_domain_model_nodedata t1
INNER JOIN neos_contentrepository_domain_model_nodedata t2
WHERE
t1.lastmodificationdatetime <= t2.lastmodificationdatetime AND
t1.persistence_object_identifier <> t2.persistence_object_identifier AND
t1.identifier = t2.identifier AND
t1.dimensionvalues = t2.dimensionvalues;
@Sebobo
Copy link
Author

Sebobo commented Sep 13, 2022

Adjust the default dimensionvalue in the first query as needed.
Afterwards run ./flow node:repair to clean the project up.

@markusguenther
Copy link

Thanks for sharing :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment