The production version of the umbraco site is huge. I'm doing a project to set up an archive. Basically, I'm starting with backup of the site, and whittling it down. Over the last 9 months, I've sometimes had to delete nodes straight out of the database because the UI would just hang. I've used the following.
First I'll check umbracoRelation table to see if there is anything related to the node I want to delete. Once I've removed all relations, I'll then run these queries:
declare @nodeID int select @nodeID = ''
DELETE FROM [ucpr].[dbo].[cmsContent] WHERE [nodeId] = @nodeID
DELETE FROM [ucpr].[dbo].[cmsPropertyData] WHERE [contentNodeId] = @nodeID
DELETE FROM [ucpr].[dbo].[cmsDocument] WHERE [nodeId] = @nodeID
DELETE FROM [ucpr].[dbo].[umbracoNode] WHERE [id] = @nodeID
So far, this has been working out. I've kept notes of every nodeId I've ever delete this way, just in case I later discover that I've orphaned something.
What I now want to do is basically identify a certain type of nodes (e.g. by document type) and generate a list of NodeId's that are older than a certain date. Then, using that list of NodeId's I want to write some queries to delete those nodes. I realize I'll probably have to track the media folder separate if I want to get rid of node media artifacts (e.g. pictures, .mp3's). Of course, I want to update the cache as well. I usually just delete then wait for it to rebuild.
I want to be able to do this on an as needed basis (possibly yearly). Does anyone have any advice on my approach, or could suggest another?
DELETE FROM [cmsPropertyData] WHERE [contentNodeId] = @nodeID
DELETE FROM [cmsDocument] WHERE [nodeId] = @nodeID
DELETE FROM cmsContentVersion WHERE [contentId] = @nodeId
DELETE FROM cmsContentXml WHERE [nodeId] = @nodeId
DELETE FROM umbracoRelation WHERE [parentId] = @nodeId
delete nodes from database
Version:4.0.4.2::Asp.Net:2.0.50727::Windows 2003 Server::IIS:6
The production version of the umbraco site is huge. I'm doing a project to set up an archive. Basically, I'm starting with backup of the site, and whittling it down. Over the last 9 months, I've sometimes had to delete nodes straight out of the database because the UI would just hang. I've used the following.
First I'll check umbracoRelation table to see if there is anything related to the node I want to delete. Once I've removed all relations, I'll then run these queries:
declare @nodeID int
select @nodeID = ''
DELETE FROM [ucpr].[dbo].[cmsContent]
WHERE [nodeId] = @nodeID
DELETE FROM [ucpr].[dbo].[cmsPropertyData]
WHERE [contentNodeId] = @nodeID
DELETE FROM [ucpr].[dbo].[cmsDocument]
WHERE [nodeId] = @nodeID
DELETE FROM [ucpr].[dbo].[umbracoNode]
WHERE [id] = @nodeID
So far, this has been working out. I've kept notes of every nodeId I've ever delete this way, just in case I later discover that I've orphaned something.
What I now want to do is basically identify a certain type of nodes (e.g. by document type) and generate a list of NodeId's that are older than a certain date. Then, using that list of NodeId's I want to write some queries to delete those nodes. I realize I'll probably have to track the media folder separate if I want to get rid of node media artifacts (e.g. pictures, .mp3's). Of course, I want to update the cache as well. I usually just delete then wait for it to rebuild.
I want to be able to do this on an as needed basis (possibly yearly). Does anyone have any advice on my approach, or could suggest another?
Correction to above queries:
declare @nodeID int
select @nodeID = ''
DELETE FROM [cmsContent]
WHERE [nodeId] = @nodeID
DELETE FROM [cmsPropertyData]
WHERE [contentNodeId] = @nodeID
DELETE FROM [cmsDocument]
WHERE [nodeId] = @nodeID
DELETE FROM cmsContentVersion WHERE [contentId] = @nodeId
DELETE FROM cmsContentXml WHERE [nodeId] = @nodeId
DELETE FROM umbracoRelation WHERE [parentId] = @nodeId
DELETE FROM [umbracoNode]
WHERE [id] = @nodeID
I tried the above but had to add two more statements because of database constraints:
DELETE from cmsPreviewXml where [nodeId] = @nodeID
DELETE from umbracoUser2NodePermission where [nodeId] = @nodeID
Cool, thanks. Regarding large sites in Umbraco, here's another resource I recently found out about:
https://groups.google.com/forum/#!topic/umbraco-dev/Spw1bDYhuEo
is working on a reply...