--upgrade scripts from nopCommerce 2.00 to nopCommerce 2.10 --new locale resources declare @resources xml --a resource will be delete if its value is empty set @resources=' Head HTML tag start HTML tag]]> Header links Header selectors Header menu Before content Before left side column After left side column Before main column After main column Before right side column After right side column After content Footer end HTML tag]]> Widgets back to widget list Edit widget details Add a new widget Button code(max 2000) Enter your button code here. Monitoring code(max 2000) Enter your monitoring code here. Available Widget Plugins Plugin Add to zone Widgets Widget zone Widget name Display order Widget zone Select widget zone. Widget name Used widget name. Display order The widget display order. 1 represents the first item in the list. Added a new widget (ID = {0}) Edited a widget (ID = {0}) Deleted a widget (ID = {0}) The new widget has been added successfully. The widget has been deleted successfully. The widget has been updated successfully. Live chat ID Enter Google Analytics ID. Tracking code Paste the tracking code generated by Google Analytics here. This tracking code will be used to track when a new visitor arrives. You can then login to Google Analytics to view the customer''s details including which site they came from and conversion details. External authentication settings Auto register enabled Check to enable auto registration when using external authentication. External authentication methods back to authentication method list Configure Friendly name System name Display order Is active Consumer key Enter your consumer key here. Consumer secret Enter your consumer key here. Client key identifier Enter your client key identifier here. Client secret Enter your client key here. External authentication Email External identifier Authentication method External authentication Email External identifier Authentication method The gift card code was applied The coupon code was applied SEO friendly URLs with multiple languages enabled When enabled, your URLs will be http://www.yourStore.com/en/ or http://www.yourStore.com/ru/ (SEO friendly) Unique SEO code The unique two letter SEO code. It''s used to generate URLs like ''http://www.yourStore.com/en/'' when you have more than one published language. ''SEO friendly URLs with multiple languages'' option should also be enabled. Two letter SEO code should be 2 characters long. Please provide an unique SEO code. Default Google category The default Google category will be useds if other one is not specified. General Override product settings Product Google Category Day Month Year Disable wishlist button Check to disable the wishlist button for this product. Product template Choose a product template. This template defines how this product (and it''s variants) will be displayed. The download file. System customer roles can''t be disabled. The system name of system customer roles can''t be edited. No addresses ' CREATE TABLE #LocaleStringResourceTmp ( [ResourceName] [nvarchar](200) NOT NULL, [ResourceValue] [nvarchar](max) NOT NULL ) INSERT INTO #LocaleStringResourceTmp (ResourceName, ResourceValue) SELECT nref.value('@Name', 'nvarchar(200)'), nref.value('Value[1]', 'nvarchar(MAX)') FROM @resources.nodes('//Language/LocaleResource') AS R(nref) --do it for each existing language DECLARE @ExistingLanguageID int DECLARE cur_existinglanguage CURSOR FOR SELECT [ID] FROM [Language] OPEN cur_existinglanguage FETCH NEXT FROM cur_existinglanguage INTO @ExistingLanguageID WHILE @@FETCH_STATUS = 0 BEGIN DECLARE @ResourceName nvarchar(200) DECLARE @ResourceValue nvarchar(MAX) DECLARE cur_localeresource CURSOR FOR SELECT ResourceName, ResourceValue FROM #LocaleStringResourceTmp OPEN cur_localeresource FETCH NEXT FROM cur_localeresource INTO @ResourceName, @ResourceValue WHILE @@FETCH_STATUS = 0 BEGIN IF (EXISTS (SELECT 1 FROM [LocaleStringResource] WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName)) BEGIN UPDATE [LocaleStringResource] SET [ResourceValue]=@ResourceValue WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName END ELSE BEGIN INSERT INTO [LocaleStringResource] ( [LanguageID], [ResourceName], [ResourceValue] ) VALUES ( @ExistingLanguageID, @ResourceName, @ResourceValue ) END IF (@ResourceValue is null or @ResourceValue = '') BEGIN DELETE [LocaleStringResource] WHERE LanguageID=@ExistingLanguageID AND ResourceName=@ResourceName END FETCH NEXT FROM cur_localeresource INTO @ResourceName, @ResourceValue END CLOSE cur_localeresource DEALLOCATE cur_localeresource --fetch next language identifier FETCH NEXT FROM cur_existinglanguage INTO @ExistingLanguageID END CLOSE cur_existinglanguage DEALLOCATE cur_existinglanguage DROP TABLE #LocaleStringResourceTmp GO --insert your update SQL scripts here --missed 'Manage Countries' permission record IF NOT EXISTS ( SELECT 1 FROM [dbo].[PermissionRecord] WHERE [SystemName] = N'ManageCountries') BEGIN INSERT [dbo].[PermissionRecord] ([Name], [SystemName], [Category]) VALUES (N'Manage Countries', N'ManageCountries', N'Configuration') DECLARE @PermissionRecordId INT SET @PermissionRecordId = @@IDENTITY --add it to admni role be default DECLARE @AdminCustomerRoleId int SELECT @AdminCustomerRoleId = Id FROM [CustomerRole] WHERE IsSystemRole=1 and [SystemName] = N'Administrators' INSERT [dbo].[PermissionRecord_Role_Mapping] ([PermissionRecord_Id], [CustomerRole_Id]) VALUES (@PermissionRecordId, @AdminCustomerRoleId) END GO --Widgets IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[Widget]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1) BEGIN CREATE TABLE [dbo].[Widget]( [Id] [int] IDENTITY(1,1) NOT NULL, [WidgetZoneId] int NOT NULL, [PluginSystemName] [nvarchar](max) NULL, [DisplayOrder] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) END GO --'Manage Widgets' permission record IF NOT EXISTS ( SELECT 1 FROM [dbo].[PermissionRecord] WHERE [SystemName] = N'ManageWidgets') BEGIN INSERT [dbo].[PermissionRecord] ([Name], [SystemName], [Category]) VALUES (N'Manage Widgets', N'ManageWidgets', N'Configuration') DECLARE @PermissionRecordId INT SET @PermissionRecordId = @@IDENTITY --add it to admni role be default DECLARE @AdminCustomerRoleId int SELECT @AdminCustomerRoleId = Id FROM [CustomerRole] WHERE IsSystemRole=1 and [SystemName] = N'Administrators' INSERT [dbo].[PermissionRecord_Role_Mapping] ([PermissionRecord_Id], [CustomerRole_Id]) VALUES (@PermissionRecordId, @AdminCustomerRoleId) END GO --Widgets activity log records IF NOT EXISTS ( SELECT 1 FROM [dbo].[ActivityLogType] WHERE [SystemKeyword] = N'AddNewWidget') BEGIN INSERT [dbo].[ActivityLogType] ([SystemKeyword], [Name], [Enabled]) VALUES (N'AddNewWidget', N'Add a new widget', 1) END GO IF NOT EXISTS ( SELECT 1 FROM [dbo].[ActivityLogType] WHERE [SystemKeyword] = N'EditWidget') BEGIN INSERT [dbo].[ActivityLogType] ([SystemKeyword], [Name], [Enabled]) VALUES (N'EditWidget', N'Edit a widget', 1) END GO IF NOT EXISTS ( SELECT 1 FROM [dbo].[ActivityLogType] WHERE [SystemKeyword] = N'DeleteWidget') BEGIN INSERT [dbo].[ActivityLogType] ([SystemKeyword], [Name], [Enabled]) VALUES (N'DeleteWidget', N'Delete a widget', 1) END GO -- ExternalAuthenticationRecord (OpenId, OAuth, etc) IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ExternalAuthenticationRecord]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1) BEGIN CREATE TABLE [dbo].[ExternalAuthenticationRecord]( [Id] [int] IDENTITY(1,1) NOT NULL, [CustomerId] int NOT NULL, [ExternalIdentifier] [nvarchar](max) NULL, [ExternalDisplayIdentifier] [nvarchar](max) NULL, [OAuthToken] [nvarchar](max) NULL, [OAuthAccessToken] [nvarchar](max) NULL, [ProviderSystemName] [nvarchar](max) NULL, PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) END GO IF EXISTS (SELECT 1 FROM sys.objects WHERE name = 'ExternalAuthenticationRecord_Customer' AND parent_object_id = Object_id('ExternalAuthenticationRecord') AND Objectproperty(object_id,N'IsForeignKey') = 1) ALTER TABLE dbo.ExternalAuthenticationRecord DROP CONSTRAINT ExternalAuthenticationRecord_Customer GO ALTER TABLE [dbo].[ExternalAuthenticationRecord] WITH CHECK ADD CONSTRAINT [ExternalAuthenticationRecord_Customer] FOREIGN KEY([CustomerId]) REFERENCES [dbo].[Customer] ([Id]) ON DELETE CASCADE GO --'Manage External Authentication Methods' permission record IF NOT EXISTS ( SELECT 1 FROM [dbo].[PermissionRecord] WHERE [SystemName] = N'ManageExternalAuthenticationMethods') BEGIN INSERT [dbo].[PermissionRecord] ([Name], [SystemName], [Category]) VALUES (N'Manage External Authentication Methods', N'ManageExternalAuthenticationMethods', N'Configuration') DECLARE @PermissionRecordId INT SET @PermissionRecordId = @@IDENTITY --add it to admni role be default DECLARE @AdminCustomerRoleId int SELECT @AdminCustomerRoleId = Id FROM [CustomerRole] WHERE IsSystemRole=1 and [SystemName] = N'Administrators' INSERT [dbo].[PermissionRecord_Role_Mapping] ([PermissionRecord_Id], [CustomerRole_Id]) VALUES (@PermissionRecordId, @AdminCustomerRoleId) END GO --[Value] column of [CustomerAttribute] can have up to 4000 chars ALTER TABLE [dbo].[CustomerAttribute] ALTER COLUMN [Value] nvarchar(4000) NOT NULL GO --Add one more column to [ExternalAuthenticationRecord] table IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[ExternalAuthenticationRecord]') and NAME='Email') BEGIN ALTER TABLE [dbo].[ExternalAuthenticationRecord] ADD [Email] nvarchar(MAX) NULL END GO DELETE FROM [Setting] WHERE [NAME]=N'storeinformationsettings.currentversion' GO --'returnrequestreasons' and 'returnrequestactions' should be reverted UPDATE [Setting] SET [Value] = N'Received Wrong Product,Wrong Product Ordered,There Was A Problem With The Product' WHERE [name] = N'ordersettings.returnrequestreasons' GO UPDATE [Setting] SET [Value] = N'Repair,Replacement,Store Credit' WHERE [name] = N'ordersettings.returnrequestactions' GO --SEO friendly language URLs IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Language]') and NAME='UniqueSeoCode') BEGIN ALTER TABLE [dbo].[Language] ADD [UniqueSeoCode] [nvarchar](2) NULL END GO --set defaults UPDATE [dbo].[Language] SET [UniqueSeoCode] = SUBSTRING ([LanguageCulture], 1, 2) GO --performance optimization (indexes) IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_LocaleStringResource' and object_id=object_id(N'[dbo].[LocaleStringResource]')) BEGIN CREATE NONCLUSTERED INDEX [IX_LocaleStringResource] ON [dbo].[LocaleStringResource] ( [ResourceName] ASC, [LanguageId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_ProductVariant_ProductId' and object_id=object_id(N'[dbo].[ProductVariant]')) BEGIN CREATE NONCLUSTERED INDEX [IX_ProductVariant_ProductId] ON [dbo].[ProductVariant] ([ProductId]) INCLUDE ([Price],[AvailableStartDateTimeUtc],[AvailableEndDateTimeUtc],[Published],[Deleted]) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Country_DisplayOrder' and object_id=object_id(N'[dbo].[Country]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Country_DisplayOrder] ON [dbo].[Country] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_StateProvince_CountryId' and object_id=object_id(N'[dbo].[StateProvince]')) BEGIN CREATE NONCLUSTERED INDEX [IX_StateProvince_CountryId] ON [dbo].[StateProvince] ([CountryId]) INCLUDE ([DisplayOrder]) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Currency_DisplayOrder' and object_id=object_id(N'[dbo].[Currency]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Currency_DisplayOrder] ON [dbo].[Currency] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Log_CreatedOnUtc' and object_id=object_id(N'[dbo].[Log]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Log_CreatedOnUtc] ON [dbo].[Log] ( [CreatedOnUtc] ASC ) END GO --[Email] column of [Customer] can have up to 1000 chars ALTER TABLE [dbo].[Customer] ALTER COLUMN [Email] nvarchar(1000) NULL GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Customer_Email' and object_id=object_id(N'[dbo].[Customer]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Customer_Email] ON [dbo].[Customer] ( [Email] ASC ) END GO --[Username] column of [Customer] can have up to 1000 chars ALTER TABLE [dbo].[Customer] ALTER COLUMN [Username] nvarchar(1000) NULL GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Customer_Username' and object_id=object_id(N'[dbo].[Customer]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Customer_Username] ON [dbo].[Customer] ( [Username] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Customer_CustomerGuid' and object_id=object_id(N'[dbo].[Customer]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Customer_CustomerGuid] ON [dbo].[Customer] ( [CustomerGuid] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_QueuedEmail_CreatedOnUtc' and object_id=object_id(N'[dbo].[QueuedEmail]')) BEGIN CREATE NONCLUSTERED INDEX [IX_QueuedEmail_CreatedOnUtc] ON [dbo].[QueuedEmail] ( [CreatedOnUtc] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Order_CustomerId' and object_id=object_id(N'[dbo].[Order]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Order_CustomerId] ON [dbo].[Order] ( [CustomerId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Language_DisplayOrder' and object_id=object_id(N'[dbo].[Language]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Language_DisplayOrder] ON [dbo].[Language] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_CustomerAttribute_CustomerId' and object_id=object_id(N'[dbo].[CustomerAttribute]')) BEGIN CREATE NONCLUSTERED INDEX [IX_CustomerAttribute_CustomerId] ON [dbo].[CustomerAttribute] ( [CustomerId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_BlogPost_LanguageId' and object_id=object_id(N'[dbo].[BlogPost]')) BEGIN CREATE NONCLUSTERED INDEX [IX_BlogPost_LanguageId] ON [dbo].[BlogPost] ( [LanguageId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_BlogComment_BlogPostId' and object_id=object_id(N'[dbo].[BlogComment]')) BEGIN CREATE NONCLUSTERED INDEX [IX_BlogComment_BlogPostId] ON [dbo].[BlogComment] ( [BlogPostId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_News_LanguageId' and object_id=object_id(N'[dbo].[News]')) BEGIN CREATE NONCLUSTERED INDEX [IX_News_LanguageId] ON [dbo].[News] ( [LanguageId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_NewsComment_NewsItemId' and object_id=object_id(N'[dbo].[NewsComment]')) BEGIN CREATE NONCLUSTERED INDEX [IX_NewsComment_NewsItemId] ON [dbo].[NewsComment] ( [NewsItemId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_PollAnswer_PollId' and object_id=object_id(N'[dbo].[PollAnswer]')) BEGIN CREATE NONCLUSTERED INDEX [IX_PollAnswer_PollId] ON [dbo].[PollAnswer] ( [PollId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_ProductReview_ProductId' and object_id=object_id(N'[dbo].[ProductReview]')) BEGIN CREATE NONCLUSTERED INDEX [IX_ProductReview_ProductId] ON [dbo].[ProductReview] ( [ProductId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_OrderProductVariant_OrderId' and object_id=object_id(N'[dbo].[OrderProductVariant]')) BEGIN CREATE NONCLUSTERED INDEX [IX_OrderProductVariant_OrderId] ON [dbo].[OrderProductVariant] ( [OrderId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_OrderNote_OrderId' and object_id=object_id(N'[dbo].[OrderNote]')) BEGIN CREATE NONCLUSTERED INDEX [IX_OrderNote_OrderId] ON [dbo].[OrderNote] ( [OrderId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_TierPrice_ProductVariantId' and object_id=object_id(N'[dbo].[TierPrice]')) BEGIN CREATE NONCLUSTERED INDEX [IX_TierPrice_ProductVariantId] ON [dbo].[TierPrice] ( [ProductVariantId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_ShoppingCartItem_ShoppingCartTypeId_CustomerId' and object_id=object_id(N'[dbo].[ShoppingCartItem]')) BEGIN CREATE NONCLUSTERED INDEX [IX_ShoppingCartItem_ShoppingCartTypeId_CustomerId] ON [dbo].[ShoppingCartItem] ( [ShoppingCartTypeId] ASC, [CustomerId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_RelatedProduct_ProductId1' and object_id=object_id(N'[dbo].[RelatedProduct]')) BEGIN CREATE NONCLUSTERED INDEX [IX_RelatedProduct_ProductId1] ON [dbo].[RelatedProduct] ( [ProductId1] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_ProductVariant_DisplayOrder' and object_id=object_id(N'[dbo].[ProductVariant]')) BEGIN CREATE NONCLUSTERED INDEX [IX_ProductVariant_DisplayOrder] ON [dbo].[ProductVariant] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_ProductVariantAttributeValue_ProductVariantAttributeId' and object_id=object_id(N'[dbo].[ProductVariantAttributeValue]')) BEGIN CREATE NONCLUSTERED INDEX [IX_ProductVariantAttributeValue_ProductVariantAttributeId] ON [dbo].[ProductVariantAttributeValue] ( [ProductVariantAttributeId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_ProductVariant_ProductAttribute_Mapping_ProductVariantId' and object_id=object_id(N'[dbo].[ProductVariant_ProductAttribute_Mapping]')) BEGIN CREATE NONCLUSTERED INDEX [IX_ProductVariant_ProductAttribute_Mapping_ProductVariantId] ON [dbo].[ProductVariant_ProductAttribute_Mapping] ( [ProductVariantId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Manufacturer_DisplayOrder' and object_id=object_id(N'[dbo].[Manufacturer]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Manufacturer_DisplayOrder] ON [dbo].[Manufacturer] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Category_DisplayOrder' and object_id=object_id(N'[dbo].[Category]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Category_DisplayOrder] ON [dbo].[Category] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Category_ParentCategoryId' and object_id=object_id(N'[dbo].[Category]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Category_ParentCategoryId] ON [dbo].[Category] ( [ParentCategoryId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Group_DisplayOrder' and object_id=object_id(N'[dbo].[Forums_Group]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Group_DisplayOrder] ON [dbo].[Forums_Group] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Forum_DisplayOrder' and object_id=object_id(N'[dbo].[Forums_Forum]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Forum_DisplayOrder] ON [dbo].[Forums_Forum] ( [DisplayOrder] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Forum_ForumGroupId' and object_id=object_id(N'[dbo].[Forums_Forum]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Forum_ForumGroupId] ON [dbo].[Forums_Forum] ( [ForumGroupId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Topic_ForumId' and object_id=object_id(N'[dbo].[Forums_Topic]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Topic_ForumId] ON [dbo].[Forums_Topic] ( [ForumId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Post_TopicId' and object_id=object_id(N'[dbo].[Forums_Post]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Post_TopicId] ON [dbo].[Forums_Post] ( [TopicId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Post_CustomerId' and object_id=object_id(N'[dbo].[Forums_Post]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Post_CustomerId] ON [dbo].[Forums_Post] ( [CustomerId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Subscription_ForumId' and object_id=object_id(N'[dbo].[Forums_Subscription]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Subscription_ForumId] ON [dbo].[Forums_Subscription] ( [ForumId] ASC ) END GO IF NOT EXISTS (SELECT 1 from sys.indexes WHERE [NAME]=N'IX_Forums_Subscription_TopicId' and object_id=object_id(N'[dbo].[Forums_Subscription]')) BEGIN CREATE NONCLUSTERED INDEX [IX_Forums_Subscription_TopicId] ON [dbo].[Forums_Subscription] ( [TopicId] ASC ) END GO --Allow store owner to disable "Add to wishlist" button for a certain product variant IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[ProductVariant]') and NAME='DisableWishlistButton') BEGIN ALTER TABLE [dbo].[ProductVariant] ADD [DisableWishlistButton] [bit] NULL EXEC ('UPDATE [dbo].[ProductVariant] SET [DisableWishlistButton] = [DisableBuyButton]') ALTER TABLE [dbo].[ProductVariant] ALTER COLUMN [DisableWishlistButton] [bit] NOT NULL END GO --Product templates IF NOT EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ProductTemplate]') and OBJECTPROPERTY(object_id, N'IsUserTable') = 1) BEGIN CREATE TABLE [dbo].[ProductTemplate]( [Id] [int] IDENTITY(1,1) NOT NULL, [Name] [nvarchar](400) NOT NULL, [ViewPath] [nvarchar](400) NOT NULL, [DisplayOrder] [int] NOT NULL, PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ) END GO IF NOT EXISTS ( SELECT 1 FROM [dbo].[ProductTemplate] WHERE [Name] = N'Variants in Grid') BEGIN INSERT [dbo].[ProductTemplate] ([Name], [ViewPath], [DisplayOrder]) VALUES (N'Variants in Grid', N'ProductTemplate.VariantsInGrid', 1) END GO IF NOT EXISTS ( SELECT 1 FROM [dbo].[ProductTemplate] WHERE [Name] = N'Single Product Variant') BEGIN INSERT [dbo].[ProductTemplate] ([Name], [ViewPath], [DisplayOrder]) VALUES (N'Single Product Variant', N'ProductTemplate.SingleVariant', 10) END GO IF NOT EXISTS (SELECT 1 FROM sys.columns WHERE object_id=object_id('[dbo].[Product]') and NAME='ProductTemplateId') BEGIN ALTER TABLE [dbo].[Product] ADD [ProductTemplateId] int NULL END GO UPDATE [dbo].[Product] SET [ProductTemplateId]=1 WHERE [ProductTemplateId] is null GO ALTER TABLE [dbo].[Product] ALTER COLUMN [ProductTemplateId] int NOT NULL GO --rounding issue UPDATE [Setting] SET [Value] = N'true' WHERE [name] = N'shoppingcartsettings.roundpricesduringcalculation' GO