Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFERENCE constraint on IContentService.deleteVerions #5919

Closed
hynekk opened this issue Jul 17, 2019 · 2 comments · Fixed by #6543
Closed

REFERENCE constraint on IContentService.deleteVerions #5919

hynekk opened this issue Jul 17, 2019 · 2 comments · Fixed by #6543

Comments

@hynekk
Copy link

hynekk commented Jul 17, 2019

Hello,

version 8.0.2

on contentService_Saved (ContentService.Saved += ContentService_Saved) to prevent saving huge amount of versions in future I call

private void ContentService_Saved(Umbraco.Core.Services.IContentService sender, Umbraco.Core.Events.ContentSavedEventArgs e)
        {
            foreach (var node in e.SavedEntities)
            {
                sender.DeleteVersions(node.Id, DateTime.Now.AddDays(-60));
            }
        }

getting

Server error: Contact administrator, see log for full details. The DELETE statement conflicted with the REFERENCE constraint "FK_umbracoDocumentVersion_umbracoContentVersion_id". The conflict occurred in database "DBNAME", table "dbo.umbracoDocumentVersion", column 'id'. The statement has been terminated.


This item has been added to our backlog AB#2208

@hynekk hynekk changed the title REFERENCE constraint on deleteVerions REFERENCE constraint on IContentService.deleteVerions Jul 17, 2019
@nul800sebastiaan
Copy link
Member

I can reproduce this one on 8.1.1 as well.

@nul800sebastiaan
Copy link
Member

Fixed in #6259

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants