Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Mila Pandurska 75 posts 354 karma points
    Mar 20, 2020 @ 07:05
    Mila Pandurska
    0

    Empty Media Recycle Bin

    Hi all, I have umbraco 8.1.5 website and I want to delete a folder which contains another subfolders from Media Recycle bin. My structure is: enter image description here

    When I right click on Patient Images and click delete I got the following error:

    The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "FK_umbracoNode_umbracoNode_id". The conflict occurred in database "VMDent_Live", table "dbo.umbracoNode", column 'parentId'. The statement has been terminated.
    

    I understand why I am getting the error - "Patent Images" is parent of the subnodes, but I have a lot of subnodes and deleting them manually is not an option. Is there a way to delete the parent folder with all of its subnodes.

  • Bipin Kataria 29 posts 60 karma points
    Dec 27, 2023 @ 05:02
    Bipin Kataria
    0

    -- This will identify orphan nodes and delete those notes.

    DELETE FROM dbo.cmsPropertyData WHERE contentNodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );

    DELETE FROM dbo.cmsPreviewXml WHERE nodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );

    DELETE FROM dbo.cmsContentVersion WHERE ContentId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );

    DELETE FROM dbo.cmsDocument WHERE nodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );

    DELETE FROM dbo.cmsContent WHERE nodeId IN ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL );

    ALTER TABLE umbracoNode NOCHECK CONSTRAINT FKumbracoNodeumbracoNodeid; DELETE FROM umbracoNode WHERE id in ( select items.id from umbracoNode as items left join umbracoNode as parent on items.parentID = parent.id WHERE parent.id is NULL ); ALTER TABLE umbracoNode CHECK CONSTRAINT FKumbracoNodeumbracoNodeid;

  • Bipin Kataria 29 posts 60 karma points
    Dec 27, 2023 @ 05:07
    Bipin Kataria
    0

    You can also manually delete problemetic nodes using below SQL code.

    DELETE FROM dbo.cmsPropertyData WHERE contentNodeId IN (67898);
    DELETE FROM dbo.cmsContentVersion WHERE ContentId IN (67898);
    DELETE FROM dbo.cmsPreviewXml WHERE nodeId IN (67898);
    DELETE FROM dbo.cmsDocument WHERE nodeId IN (67898);
    DELETE FROM dbo.cmsMember2MemberGroup WHERE Member IN (67898);
    DELETE FROM dbo.cmsMember WHERE nodeId IN (67898);
    DELETE FROM dbo.cmsContentXml WHERE nodeId IN (67898);
    DELETE FROM dbo.cmsContent WHERE nodeId IN (67898);
    
    ALTER TABLE umbracoNode NOCHECK CONSTRAINT FK_umbracoNode_umbracoNode_id;
    DELETE FROM umbracoNode WHERE id in (67898);
    ALTER TABLE umbracoNode CHECK CONSTRAINT FK_umbracoNode_umbracoNode_id;
    
Please Sign in or register to post replies

Write your reply to:

Draft