Last active
October 8, 2019 15:26
-
-
Save garpunkal/540dc12ea4f6a65efef69639af2f60c4 to your computer and use it in GitHub Desktop.
Umbraco Delete Documents By DocType
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
DECLARE @Nodes TABLE (NodeId int) | |
INSERT INTO @Nodes (NodeId) | |
SELECT n.id | |
FROM cmsContent C | |
INNER JOIN cmsContentType CT ON C.contentType = CT.nodeId | |
INNER JOIN umbracoNode N ON C.nodeId = N.id | |
WHERE CT.alias = 'Twitter' OR CT.alias = 'Instagram' OR CT.alias = 'SocialPost' | |
delete from cmsPreviewXml where nodeId in (select NodeId from @Nodes) | |
delete from cmsContentVersion where contentId in (select NodeId from @Nodes) | |
delete from cmsDocument where nodeId in (select NodeId from @Nodes) | |
delete from cmsContentXML where nodeId in (select NodeId from @Nodes) | |
delete from cmsTagRelationship where nodeId in (select NodeId from @Nodes) | |
delete from cmsContent where nodeId in (select NodeId from @Nodes) | |
delete from cmsPropertyData where contentNodeId in (select NodeId from @Nodes) | |
delete from umbracoRelation where parentId in (select NodeId from @Nodes) OR childId in (select NodeId from @Nodes) | |
delete from umbracoNode where id in (select NodeId from @Nodes) | |
DELETE FROM @Nodes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment