Copied to clipboard

Flag this post as spam?

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


  • Bruno 23 posts 53 karma points
    Oct 28, 2016 @ 00:28
    Bruno
    0

    Media recycle bin can't be emptied

    Using umbraco 7.34, tried to empty recycle bin, failed, and got this error :

    System.Data.SqlClient.SqlException: The DELETE statement conflicted with the SAME TABLE REFERENCE constraint "FK_umbracoNode_umbracoNode_id". The conflict occurred in database "DB_xxxxxx_xxxx", table "dbo.umbracoNode", column 'parentID'.
     The statement has been terminated.
    

    I am not sure if this is related to another problem : Upload files to media fail with error

  • Julio M. Vivas 61 posts 122 karma points
    Nov 17, 2016 @ 12:14
    Julio M. Vivas
    0

    Hi Bruno

    I'm getting something similar on 7.4.2 but I think is more related to this issue http://issues.umbraco.org/issue/U4-8239

    It seems to have been fixed on 7.5.3 which flushed the Media Bin with no complaints

    However, if upgrading is not an option and you need that Media bin emptied ASAP, this SQL sequence still works at clearing the lot:

    delete from cmsPreviewXml where nodeId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from cmsContentVersion where contentId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from cmsDocument where nodeId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from cmsContentXML where nodeId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from cmsContent where nodeId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from cmsPropertyData where contentNodeId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from dbo.umbracoUser2NodePermission where nodeId in (select id from umbracoNode where path like '%-21%' and id!=-21)
    delete from dbo.umbracoRelation where parentId in (select id from umbracoNode where path like '%-21%' and id!=-21) 
    or childId in (select id from umbracoNode where path like '%-21%' and id!=-21) 
    -- delete the XML nodes....
    ALTER TABLE umbracoNode NOCHECK CONSTRAINT FK_umbracoNode_umbracoNode
    delete umbracoNode where id in (select id from umbracoNode where path like '%-21%' and id!=-21)
    ALTER TABLE umbracoNode CHECK CONSTRAINT FK_umbracoNode_umbracoNode
    
    delete from umbracoNode where path like '%-21%' and id!=-21
    
Please Sign in or register to post replies

Write your reply to:

Draft