SQL error when staging pdf file

jeff McDaniel asked on February 15, 2017 19:10

Hi,

We recently upgraded from kentico 8.2 to 9, and again from 9 to 10. Everything went well and we didn't see any errors from the Kentico upgrade side. Now we can't stage files from one environment to another using the staging application. I am attempting to update a pdf that exists on both environments, and run into this error on every environment that we upgraded.

SyncServer.ServerError: Exception occurred: [DataConnection.HandleError]: 
Query: INSERT INTO CMS_AttachmentHistory ([AttachmentName], [AttachmentExtension], [AttachmentSize], [AttachmentMimeType], [AttachmentBinary], [AttachmentImageWidth], [AttachmentImageHeight], [AttachmentDocumentID], [AttachmentGUID], [AttachmentIsUnsorted], [AttachmentOrder], [AttachmentGroupGUID], [AttachmentHash], [AttachmentTitle], [AttachmentDescription], [AttachmentCustomData], [AttachmentLastModified], [AttachmentHistoryGUID], [AttachmentSiteID], [AttachmentSearchContent], [AttachmentVariantDefinitionIdentifier], [AttachmentVariantParentID]) 

VALUES (@AttachmentName, @AttachmentExtension, @AttachmentSize, @AttachmentMimeType, @AttachmentBinary, @AttachmentImageWidth, @AttachmentImageHeight, @AttachmentDocumentID, @AttachmentGUID, @AttachmentIsUnsorted, @AttachmentOrder, @AttachmentGroupGUID, @AttachmentHash, @AttachmentTitle, @AttachmentDescription, @AttachmentCustomData, @AttachmentLastModified, @AttachmentHistoryGUID, @AttachmentSiteID, @AttachmentSearchContent, @AttachmentVariantDefinitionIdentifier, @AttachmentVariantParentID);

SELECT SCOPE_IDENTITY() AS [ID] Caused exception: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_CMS_AttachmentHistory_AttachmentSiteID_CMS_Site". The conflict occurred in database "KenticoCMS_Sec", table "dbo.CMS_Site", column 'SiteID'. The statement has been terminated.

It looks like the attachment history table is having a foreign key constraint with the Site ID in the sites table. This happens on existing files as well as new files. We can't stage because of this and I've been looking all over for any source of direction to go with this. The upgrade didn't throw any errors and said it went successful so I'm not sure why this is happening.

Any help would be greatly apprecaited.

Thank you.

Recent Answers


Dawid Jachnik answered on February 16, 2017 08:36

Hello,

try to synchronize the databases?

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.