probleme upgading

alzo alzo asked on September 22, 2020 19:01

Query:

ALTER TABLE [CMS_Tree] ALTER COLUMN [NodeParentID] [int] NULL; UPDATE [CMS_Tree] SET [NodeParentID] = NULL WHERE [NodeParentID] = 0

DECLARE @NodeID int, @NodeGUID uniqueidentifier, @NodeSiteID int;

DECLARE @cursor CURSOR;

DECLARE @orphans TABLE ( NodeID int, NodeGUID uniqueidentifier, NodeSiteID int );

INSERT INTO @orphans SELECT DISTINCT NodeID, NodeGUID, NodeSiteID FROM CMS_Tree WHERE NodeParentID NOT IN (SELECT NodeID FROM CMS_Tree)

SET @cursor = CURSOR FOR SELECT NodeID, NodeGUID, NodeSiteID FROM @orphans; OPEN @cursor FETCH NEXT FROM @cursor INTO @NodeID, @NodeGUID, @NodeSiteID

WHILE @@FETCH_STATUS = 0 BEGIN EXEC Proc_CMS_Tree_RemoveDependencies @NodeID, @NodeGUID, @NodeSiteID DELETE FROM CMS_Document WHERE DocumentNodeID = @NodeID DELETE FROM CMS_Tree WHERE NodeID = @NodeID

FETCH NEXT FROM @cursor INTO @NodeID, @NodeGUID, @NodeSiteID

END

CLOSE @cursor; DEALLOCATE @cursor;

ALTER TABLE [CMS_Tree] WITH CHECK ADD CONSTRAINT [FK_CMS_Tree_NodeParentID_CMS_Tree] FOREIGN KEY([NodeParentID]) REFERENCES [CMS_Tree] ([NodeID]) ALTER TABLE [CMS_Tree] CHECK CONSTRAINT [FK_CMS_Tree_NodeParentID_CMS_Tree] ALTER TABLE [CMS_Tree] DROP CONSTRAINT [FK_CMS_Tree_CMS_Tree]

Caused exception: The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_DocumentCategory_DocumentID_CMS_Document". The conflict occurred in database "my_DB", table "dbo.CMS_DocumentCategory", column 'DocumentID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Document_DocumentNodeID_CMS_Tree". The conflict occurred in database "my_DB", table "dbo.CMS_Document", column 'DocumentNodeID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Attachment_AttachmentDocumentID_CMS_Document". The conflict occurred in database "my_DB", table "dbo.CMS_Attachment", column 'AttachmentDocumentID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Document_DocumentNodeID_CMS_Tree". The conflict occurred in database "my_DB", table "dbo.CMS_Document", column 'DocumentNodeID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Attachment_AttachmentDocumentID_CMS_Document". The conflict occurred in database "my_DB", table "dbo.CMS_Attachment", column 'AttachmentDocumentID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Document_DocumentNodeID_CMS_Tree". The conflict occurred in database "my_DB", table "dbo.CMS_Document", column 'DocumentNodeID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Attachment_AttachmentDocumentID_CMS_Document". The conflict occurred in database "my_DB", table "dbo.CMS_Attachment", column 'AttachmentDocumentID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Document_DocumentNodeID_CMS_Tree". The conflict occurred in database "my_DB", table "dbo.CMS_Document", column 'DocumentNodeID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Attachment_AttachmentDocumentID_CMS_Document". The conflict occurred in database "my_DB", table "dbo.CMS_Attachment", column 'AttachmentDocumentID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Document_DocumentNodeID_CMS_Tree". The conflict occurred in database "my_DB", table "dbo.CMS_Document", column 'DocumentNodeID'. The DELETE statement conflicted with the REFERENCE constraint "FK_CMS_Attachment_AttachmentDocumentID_CMS_Document". The conflict occurred in database "my_DB", table "dbo.CMS_Attachment", column 'AttachmentDocumentID'.

HOW TO CORRECT THESE ERRORS.

THANK YOU FOR HELPING US

Recent Answers


David te Kloese answered on September 23, 2020 14:15

Hi,

is this a clean upgrade from 8.1 to 8.2 or did you came from an earlier version?

Where are you getting this error, during the upgrade... in the event log after upgrade when site starts?

Are you applying the upgrade manually?

0 votesVote for this answer Mark as a Correct answer

alzo alzo answered on September 23, 2020 15:06

Hi 1) This is upgrade from 8.1 to 8.2 2) WHEN I upgraded in log file 3) Yes manualy

Thank u

0 votesVote for this answer Mark as a Correct answer

David te Kloese answered on September 23, 2020 15:36

Might be better to contact support (Support@kentico.com). But it seems this script tries to cleanup nodes that don't have a parent node set. Can you check which and how many nodes match that query in the DB before you do the upgrade?

And if that makes sense?

0 votesVote for this answer Mark as a Correct answer

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