During Synchronization from Stage to Production, updating any system table fails with the following error. It's trying to pass 0 as DefaultPageTemplateID instead of NULL.
Dependent task 'Update System table 'User - Settings'' failed:Synchronization server error: Exception occurred:
UPDATE CMS_Class SET [ClassDisplayName] = @ClassDisplayName, [ClassName] = @ClassName, [ClassUsesVersioning] = @ClassUsesVersioning, [ClassIsDocumentType] = @ClassIsDocumentType, [ClassIsCoupledClass] = @ClassIsCoupledClass, [ClassXmlSchema] = @ClassXmlSchema, [ClassFormDefinition] = @ClassFormDefinition, [ClassEditingPageUrl] = @ClassEditingPageUrl, [ClassListPageUrl] = @ClassListPageUrl, [ClassNodeNameSource] = @ClassNodeNameSource, [ClassTableName] = @ClassTableName, [ClassViewPageUrl] = @ClassViewPageUrl, [ClassPreviewPageUrl] = @ClassPreviewPageUrl, [ClassFormLayout] = @ClassFormLayout, [ClassNewPageUrl] = @ClassNewPageUrl, [ClassShowAsSystemTable] = @ClassShowAsSystemTable, [ClassUsePublishFromTo] = @ClassUsePublishFromTo, [ClassShowTemplateSelection] = @ClassShowTemplateSelection, [ClassSKUMappings] = @ClassSKUMappings, [ClassIsMenuItemType] = @ClassIsMenuItemType, [ClassNodeAliasSource] = @ClassNodeAliasSource, [ClassDefaultPageTemplateID] = @ClassDefaultPageTemplateID, [ClassLastModified] = @ClassLastModified, [ClassGUID] = @ClassGUID, [ClassCreateSKU] = @ClassCreateSKU, [ClassIsProduct] = @ClassIsProduct, [ClassIsCustomTable] = @ClassIsCustomTable, [ClassShowColumns] = @ClassShowColumns, [ClassLoadGeneration] = @ClassLoadGeneration, [ClassSearchTitleColumn] = @ClassSearchTitleColumn, [ClassSearchContentColumn] = @ClassSearchContentColumn, [ClassSearchImageColumn] = @ClassSearchImageColumn, [ClassSearchCreationDateColumn] = @ClassSearchCreationDateColumn, [ClassSearchSettings] = @ClassSearchSettings, [ClassInheritsFromClassID] = @ClassInheritsFromClassID, [ClassSearchEnabled] = @ClassSearchEnabled, [ClassSKUDefaultDepartmentName] = @ClassSKUDefaultDepartmentName, [ClassSKUDefaultDepartmentID] = @ClassSKUDefaultDepartmentID, [ClassContactMapping] = @ClassContactMapping, [ClassContactOverwriteEnabled] = @ClassContactOverwriteEnabled, [ClassSKUDefaultProductType] = @ClassSKUDefaultProductType, [ClassConnectionString] = @ClassConnectionString, [ClassIsProductSection] = @ClassIsProductSection, [ClassPageTemplateCategoryID] = @ClassPageTemplateCategoryID, [ClassFormLayoutType] = @ClassFormLayoutType, [ClassVersionGUID] = @ClassVersionGUID, [ClassDefaultObjectType] = @ClassDefaultObjectType, [ClassIsForm] = @ClassIsForm, [ClassResourceID] = @ClassResourceID, [ClassCustomizedColumns] = @ClassCustomizedColumns, [ClassCodeGenerationSettings] = @ClassCodeGenerationSettings, [ClassIconClass] = @ClassIconClass WHERE [ClassID] = @ClassID
Caused exception:
The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_CMS_Class_ClassDefaultPageTemplateID_CMS_PageTemplate". The conflict occurred in database "Kentico", table "dbo.CMS_PageTemplate", column 'PageTemplateID'.
The statement has been terminated.