Skip to content

Instantly share code, notes, and snippets.

@thecodefish
Created May 20, 2015 20:21
Show Gist options
  • Save thecodefish/6ca98cdaaed96a9b3fc4 to your computer and use it in GitHub Desktop.
Save thecodefish/6ca98cdaaed96a9b3fc4 to your computer and use it in GitHub Desktop.
Umbraco helper SQL script - continue adding property to document type after the UI times out
/* Originally based on script from https://our.umbraco.org/projects/developer-tools/sql-scripts */
/* Use to create missing PropertyData entries if the Umbraco UI gives a timeout error when trying
* to add a new property to an existing document type */
Declare @ContentTypeAlias nvarchar(255), @PropertyTypeAlias nvarchar(255)
Set @ContentTypeAlias = 'nodeTypeAlias'
Set @PropertyTypeAlias = 'propertyTypeAlias'
Declare @ContentTypeId int, @PropertyTypeId int
Set @ContentTypeId = ( Select top 1 nodeId
From cmsContentType
Where Alias = @ContentTypeAlias )
Set @PropertyTypeId = ( Select top 1 id
From cmsPropertyType
Where Alias = @PropertyTypeAlias AND contentTypeId = @ContentTypeId )
/* Uncomment the following line when ready to insert the records. */
--Insert Into cmsPropertyData (versionId, contentNodeId, propertytypeid)
Select cmsContentVersion.VersionId, cmsContentVersion.ContentId , @PropertyTypeId
From cmsContentVersion
Inner Join cmsContent on cmsContentVersion.ContentId = cmsContent.nodeId
Where cmsContent.contentType = @ContentTypeId and
Not Exists (
Select versionId, contentNodeId, propertytypeid
From cmsPropertyData propertyData
Where propertyData.versionId = cmsContentVersion.versionId
and propertyData.contentNodeId = cmsContentVersion.ContentId
and propertyData.propertytypeid = @PropertyTypeId
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment