Umbraco v4 - delete Recycle Bin by T-SQL


--Verify the number of nodes returned is the save as the number of nodes that is in the Recycle Bun
--select count(*) from umbracoNode where path like '%-20%' and id!=-20

begin transaction
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 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 cmsDocument where nodeId 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)
delete from cmsContent where nodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
delete from cmsPropertyData where contentNodeId in (select id from umbracoNode where path like '%-20%' and id!=-20)
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 umbracoDomains WHERE domainRootStructureID 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 umbracoUser2NodePermission where nodeId in (SELECT id FROM umbracoNode WHERE path like '%-20%' and id != -20)
-- delete the XML nodes....
delete from umbracoNode where path like '%-20%' and id!=-20
commit transaction
--Verify is done , replace rollback to commit

--Reference : http://our.umbraco.org/forum/using/ui-questions/26114-Delete-recycle-bin-problem?p=1

沒有留言:

張貼留言