begin transaction
DECLARE @newWebsiteId nvarchar(50);
DECLARE @newWebsiteName nvarchar(50);
DECLARE @newWebsiteDomain nvarchar(50);
DECLARE @defaultLanguage int;
DECLARE @homePageId nvarchar(max);
DECLARE @customerServicePageId nvarchar(max);
SET @newWebsiteId = N'NewWebsiteID'; -- set a new website ID instead of 'NewWebsiteID'
SET @newWebsiteName = N'New Website Name'; -- set the name of the new website instead of 'New Website Name'
SET @newWebsiteDomain = N'localhost'; -- set the domain for new website instead of 'localhost'
SELECT @defaultLanguage = Id FROM [Languages] WHERE [IsDefault] = 1;
-- basic website info
INSERT INTO [Websites] ([Id], [Name], [DefaultLanguageId]) VALUES (@newWebsiteId, @newWebsiteName, @defaultLanguage);
INSERT INTO [WebsiteLanguages] ([WebsiteId], [LanguageId]) VALUES (@newWebsiteId, @defaultLanguage);
INSERT INTO [WebsiteDomains] ([Id], [WebsiteId], [Domain], [IsDefault]) VALUES (NEWID(), @newWebsiteId, @newWebsiteDomain, 1);
UPDATE users SET Fields.modify('insert {sql:variable("@newWebsiteId")} into (//field[@name="Websites"]/ArrayOfString)[1]')
FROM [AdminUsers] users JOIN [AdminUsersRoles] usersRoles ON users.Id = usersRoles.AdminUserId
WHERE usersRoles.AdminRoleId = 'FE0072B6-70AA-4C53-8716-1FD9515E4998' and users.Fields.exist('//field[@name="Websites"]/ArrayOfString/string[text()=sql:variable("@newWebsiteId")]') = 0;
-- create Home page
SET @homePageId = CAST(NewId() AS nvarchar(50))
INSERT [dbo].[FlexiPages] ([Id], [WebsiteId], [Title], [CreatedDate], [ModifiedDate], [Fields], [Url]) VALUES (@homePageId, @newWebsiteId, N'Home', GETDATE(), GETDATE(), N'1423653167815/content/files/images/Homepage-banner.jpg87265895-2884-4A2F-92D4-EFE5239D0135<br>This is a Flexi-page. On a Flexi page, you are free to use blocks of text and images, to make the pages look just the way you want them to look. You can easily change the images and text of the Flexi-pages in the “Web pages” section in the Sana Admin. You can also use the In-site editor to change the content of the webstore while looking at it.68520105-5903-4D6D-9B72-666AF48435AF/content/files/images/place holder 3.jpgBlock 1 image/content/files/images/place holder 3.jpgBlock 2 image/content/files/images/place holder 3.jpgBlock 3 image', N'home')
-- create Customer service page
SET @customerServicePageId = CAST(NewId() AS nvarchar(50))
INSERT [dbo].[FlexiPages] ([Id], [WebsiteId], [Title], [CreatedDate], [ModifiedDate], [Fields], [Url]) VALUES (@customerServicePageId, @newWebsiteId, N'Customer service', GETDATE(), GETDATE(), N'<h1>Customer service</h1>
<p><br />
</p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Duis nibh neque, egestas et, aliquet a, fermentum at, nunc. In aliquam. Maecenas metus dui, laoreet in, euismod id, iaculis sit amet, felis. Suspendisse consectetuer odio nec est. Sed blandit mauris vel neque. Pellentesque at orci vitae elit iaculis imperdiet. Sed est turpis, blandit vitae, euismod eget, feugiat ac, arcu.<br />
Duis nisl. Etiam quam ligula, dapibus sed, faucibus eget, volutpat sed, est. Mauris quis sem. Donec iaculis dui fermentum eros. Pellentesque eget libero vitae sapien interdum ullamcorper. Aenean at nulla in velit tristique venenatis. Duis malesuada metus a dolor. Sed ante. Integer mi mi, sodales vitae, adipiscing a, luctus nec, diam.<br />
<br />
Maecenas aliquam aliquet massa. Donec ut purus. Maecenas volutpat, ipsum at consectetuer pretium, urna lorem tempor mi, vitae pellentesque mauris felis eget lorem. Nam ut lectus quis sem placerat venenatis. Nam et nisi non magna pulvinar dignissim. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam venenatis. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Phasellus volutpat. Integer suscipit. Mauris egestas accumsan eros. Nunc et massa. Aliquam erat volutpat.
<div style="text-align: center;"></div>
<p><br />
</p>0641C81A-ADDF-4A95-BFB8-6E4CC1793011', N'service')
-- create General settings
INSERT [dbo].[Settings] ([Fields], [WebsiteId], [Key], [CreatedDate], [ModifiedDate]) VALUES (N'EURtruefalsefalsetruescdemo@sana-commerce.comfalseSalesAgentAndB2BCustomerSalesAgentAndB2BCustomerscdemo@sana-commerce.comOrderSalesAgentAndB2BCustomertruetrueSalesAgentAndB2BCustomertruetrueSalesAgentAndB2BCustomertruetruetrueSana Store010-1112233scdemo@sana-commerce.comShowIndicatorFlexiPage' + @homePageId + 'truetrueDropdowntruefalseAllFlexiPage' + @customerServicePageId + 'falseAlwaysSendfalsefalse', @newWebsiteId, N'General', GETDATE(), GETDATE())
-- create PageLayout settings
INSERT [dbo].[Settings] ([Fields], [WebsiteId], [Key], [CreatedDate], [ModifiedDate]) VALUES (N'ListDetailsB2CSearchConsumerListB2BDetailsB2BSearchB2BBusinessListB2BDetailsB2BWithMatrixSearchBusinessSearchSearchB2BSearchB2B', @newWebsiteId, N'PageLayout', GETDATE(), GETDATE())
UPDATE [Settings] SET Fields.modify('replace value of (//field[@name="ShopName"]/string/text())[1] with sql:variable("@newWebsiteName")')
WHERE [Key] = 'General' AND [WebsiteId] = @newWebsiteId;
commit