diff --git a/umbraco/datalayer/SqlHelpers/SqlServer/Sql/KeysIndexesAndConstraints.sql b/umbraco/datalayer/SqlHelpers/SqlServer/Sql/KeysIndexesAndConstraints.sql index 881a9ea653..de67f95341 100644 --- a/umbraco/datalayer/SqlHelpers/SqlServer/Sql/KeysIndexesAndConstraints.sql +++ b/umbraco/datalayer/SqlHelpers/SqlServer/Sql/KeysIndexesAndConstraints.sql @@ -22,6 +22,9 @@ delete from cmsContentXml where nodeid not in (select nodeId from cmsContent) delete from cmsDocumentType where contentTypeNodeId not in (select nodeId from cmsContentType) delete from cmsDocumentType where templateNodeId not in (select nodeid from cmsTemplate) +/* UPDATE EMPTY TEMPLATE REFERENCES IN DOCUMENTS */ +update cmsDocument set templateId = NULL where templateId not in (select nodeId from cmsTemplate) + /************************** CLEANUP END ********************************************/