Last active
May 16, 2024 15:43
-
-
Save stevetemple/01ce3afb89098b6cdcbcd916e67e6115 to your computer and use it in GitHub Desktop.
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
DECLARE @langId int | |
DECLARE @siteNodeId int | |
DECLARE @currentDomainRecord INT | |
DECLARE @pageObjectType VARCHAR(100) | |
DECLARE @domain VARCHAR(250) | |
SET @domain = 'test.com' | |
SET @pageObjectType = 'A2CB7800-F571-4787-9638-BC48539A0EFB' | |
-- Get the UK language id | |
SELECT @langId = Id FROM [umbracoLanguage] WHERE languageISOCode = 'en-GB' | |
-- Get the current default site node | |
SELECT TOP 1 @siteNodeId = Id FROM [umbracoNode] WHERE [Id] > -1 AND [ParentId] = -1 AND [nodeObjectType] = @pageObjectType ORDER BY [sortOrder] | |
-- Check if we already have a record for that domain | |
SELECT TOP 1 @currentDomainRecord = Id FROM [umbracoDomain] WHERE [domainName] = @domain | |
IF(@currentDomainRecord IS NULL) | |
BEGIN | |
INSERT INTO [umbracoDomain] (domainDefaultLanguage, domainRootStructureID, domainName) | |
VALUES (@langId, @siteNodeId, @domain) | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment