Skip to content

Instantly share code, notes, and snippets.

@haukurk
Last active June 7, 2018 23:36
Show Gist options
  • Save haukurk/f0ae41f6471497600749360ffc77b345 to your computer and use it in GitHub Desktop.
Save haukurk/f0ae41f6471497600749360ffc77b345 to your computer and use it in GitHub Desktop.
Empty recycle bin in Umbraco
--deletes in Document
--at this point all associated media files are deleted
delete from umbracoDomains where id in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsDocument where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
--deletes in Content
delete from cmsPropertyData where contentNodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsPreviewXml where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsContentVersion where ContentId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsContentXml where NodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
--deletes in CMSNode
delete from umbracoRelation where parentId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from umbracoRelation where childId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsTask where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from umbracoUser2NodeNotify where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsTagRelationship where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from cmsContent where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20);
delete from umbracoRedirectUrl where id in (select r.id from umbracoNode n
inner join umbracoRedirectUrl r on r.contentKey = n.uniqueID
where n.path like '%-20%' and n.id!=-20)
delete from umbracoNode where path like '%-20%' and id!=-20;
DELETE FROM cmsTagRelationship WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM umbracoUser2NodeNotify WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment