Created
May 20, 2015 20:21
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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