	--01
	DECLARE @aspnet_SchemaVersions TABLE ([Feature] [nvarchar](128) NOT NULL,[CompatibleSchemaVersion] [nvarchar](128) NOT NULL,[IsCurrentVersion] [bit] NOT NULL);

	INSERT INTO @aspnet_SchemaVersions ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion]) VALUES(N'common', N'1', 1)
	INSERT INTO @aspnet_SchemaVersions ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion]) VALUES(N'health monitoring', N'1', 1)
	INSERT INTO @aspnet_SchemaVersions ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion]) VALUES(N'membership', N'1', 1)
	INSERT INTO @aspnet_SchemaVersions ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion]) VALUES(N'personalization', N'1', 1)
	INSERT INTO @aspnet_SchemaVersions ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion]) VALUES(N'profile', N'1', 1)
	INSERT INTO @aspnet_SchemaVersions ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion]) VALUES(N'role manager', N'1', 1)

	MERGE INTO [dbo].[aspnet_SchemaVersions] AS TARGET  
	USING @aspnet_SchemaVersions AS SOURCE  
	ON TARGET.[Feature] = SOURCE.[Feature]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([Feature], [CompatibleSchemaVersion], [IsCurrentVersion])   
	VALUES (SOURCE.[Feature], SOURCE.[CompatibleSchemaVersion], SOURCE.[IsCurrentVersion])  
	OUTPUT $action, SOURCE.*;

	--02
	DECLARE @aspnet_Applications TABLE ([ApplicationName] [nvarchar](256) NOT NULL,[LoweredApplicationName] [nvarchar](256) NOT NULL,[ApplicationId] [uniqueidentifier] NOT NULL,[Description] [nvarchar](256) NULL);

	INSERT @aspnet_Applications ([ApplicationName], [LoweredApplicationName], [ApplicationId], [Description]) VALUES (N'Dashboard', N'dashboard', N'e966bd79-928a-45f9-9357-0596545f188e', NULL)
	
	MERGE INTO [dbo].[aspnet_Applications] AS TARGET  
	USING @aspnet_Applications AS SOURCE  
	ON TARGET.[ApplicationName] = SOURCE.[ApplicationName]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([ApplicationName], [LoweredApplicationName], [ApplicationId], [Description])   
	VALUES (SOURCE.[ApplicationName], SOURCE.[LoweredApplicationName], SOURCE.[ApplicationId], SOURCE.[Description])  
	OUTPUT $action, SOURCE.*;
	
	--03
	DECLARE @aspnet_Roles TABLE ([ApplicationId] [uniqueidentifier] NOT NULL,[RoleId] [uniqueidentifier] NOT NULL,[RoleName] [nvarchar](256) NOT NULL,[LoweredRoleName] [nvarchar](256) NOT NULL,[Description] [nvarchar](256) NULL);

	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'211aa088-4ec5-4906-8b0f-4ea4dbc4389d', N'Admin', N'admin', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'd6d10a1e-9939-44c6-a105-96c72de5393d', N'MasterAdmin', N'masteradmin', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'21e6cdd3-d4e5-4407-bef2-f657155e4148', N'RemoteBoot', N'remoteboot', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'6b907947-5a21-40e0-abc5-b0ae1d9afbae', N'reports', N'reports', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'ad1f4634-4273-4fec-8b8b-1a8fbfbac5ec', N'Support', N'support', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'472d582d-db86-4e9f-9cac-678fec32efee', N'User', N'user', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'9c358cfd-85c6-4a07-8c17-fc543ebed336', N'UserManagement', N'usermanagement', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'97F32DEA-DEA3-4AE2-9F92-4BE2455A1763', N'PanelsRegistration', N'panelsregistration', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'CA5BBA39-F263-4C43-80E3-2AF4C3EB5773', N'SuspendPanels', N'SuspendPanels', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'CA5BBA39-F263-4C43-80E3-2AF4C3EB5205', N'ResetToFactory', N'ResetToFactory', NULL)
	INSERT @aspnet_Roles ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'9C358CFD-85C6-4A07-8C17-FC543EBE4466', N'PanelCommands', N'panelcommands', NULL)
	
	
	
	MERGE INTO [dbo].[aspnet_Roles] AS TARGET  
	USING @aspnet_Roles AS SOURCE  
	ON TARGET.[RoleId] = SOURCE.[RoleId]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([ApplicationId], [RoleId], [RoleName], [LoweredRoleName], [Description])   
	VALUES (SOURCE.[ApplicationId], SOURCE.[RoleId], SOURCE.[RoleName], SOURCE.[LoweredRoleName], SOURCE.[Description])  
	OUTPUT $action, SOURCE.*;

	--04
    DECLARE @aspnet_Users TABLE ([ApplicationId] [uniqueidentifier] NOT NULL,[UserId] [uniqueidentifier] NOT NULL,[UserName] [nvarchar](256) NOT NULL,[LoweredUserName] [nvarchar](256) NOT NULL,[MobileAlias] [nvarchar](16) NULL,[IsAnonymous] [bit] NOT NULL,[LastActivityDate] [datetime] NOT NULL);

	INSERT @aspnet_Users ([ApplicationId], [UserId], [UserName], [LoweredUserName], [MobileAlias], [IsAnonymous], [LastActivityDate]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'master', N'master', NULL, 0, CAST(0x00009FE2006B61C4 AS DateTime))
	INSERT @aspnet_Users ([ApplicationId], [UserId], [UserName], [LoweredUserName], [MobileAlias], [IsAnonymous], [LastActivityDate]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'837e6465-14eb-4822-b70d-0a4a9261cf37', N'CmsOperatorUser', N'CmsOperatorUser', NULL, 0, CAST(0x00009FE100F8921D AS DateTime))

	MERGE INTO [dbo].[aspnet_Users] AS TARGET  
	USING @aspnet_Users AS SOURCE  
	ON TARGET.[UserId] = SOURCE.[UserId]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([ApplicationId], [UserId], [UserName], [LoweredUserName], [MobileAlias], [IsAnonymous], [LastActivityDate])   
	VALUES (SOURCE.[ApplicationId], SOURCE.[UserId], SOURCE.[UserName], SOURCE.[LoweredUserName], SOURCE.[MobileAlias],SOURCE.[IsAnonymous],SOURCE.[LastActivityDate])  
	OUTPUT $action, SOURCE.*;

	--05
	DECLARE @aspnet_UsersInRoles TABLE ([UserId] [uniqueidentifier] NOT NULL, [RoleId] [uniqueidentifier] NOT NULL);

	INSERT @aspnet_UsersInRoles ([UserId],[RoleId]) VALUES (N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'd6d10a1e-9939-44c6-a105-96c72de5393d') -- MasterAdmin
	INSERT @aspnet_UsersInRoles ([UserId],[RoleId]) VALUES (N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'6b907947-5a21-40e0-abc5-b0ae1d9afbae') -- reports
	INSERT @aspnet_UsersInRoles ([UserId],[RoleId]) VALUES (N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'ad1f4634-4273-4fec-8b8b-1a8fbfbac5ec') -- support
	INSERT @aspnet_UsersInRoles ([UserId],[RoleId]) VALUES (N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'9c358cfd-85c6-4a07-8c17-fc543ebed336') -- usermanagement
	INSERT @aspnet_UsersInRoles ([UserId],[RoleId]) VALUES (N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'21e6cdd3-d4e5-4407-bef2-f657155e4148') -- remoteboot
	INSERT @aspnet_UsersInRoles ([UserId],[RoleId]) VALUES (N'837e6465-14eb-4822-b70d-0a4a9261cf37', N'472d582d-db86-4e9f-9cac-678fec32efee')

	MERGE INTO [dbo].[aspnet_UsersInRoles] AS TARGET  
	USING @aspnet_UsersInRoles AS SOURCE  
	ON TARGET.[UserId] = SOURCE.[UserId]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([UserId],[RoleId])   
	VALUES (SOURCE.[UserId], SOURCE.[RoleId])  
	OUTPUT $action, SOURCE.*;

	--06
	DECLARE @aspnet_Membership TABLE ([ApplicationId] [uniqueidentifier] NOT NULL,[UserId] [uniqueidentifier] NOT NULL,[Password] [nvarchar](128) NOT NULL,[PasswordFormat] [int] NOT NULL,[PasswordSalt] [nvarchar](128) NOT NULL,[MobilePIN] [nvarchar](16) NULL,[Email] [nvarchar](256) NULL,[LoweredEmail] [nvarchar](256) NULL,[PasswordQuestion] [nvarchar](256) NULL,[PasswordAnswer] [nvarchar](128) NULL,[IsApproved] [bit] NOT NULL,[IsLockedOut] [bit] NOT NULL,[CreateDate] [datetime] NOT NULL,[LastLoginDate] [datetime] NOT NULL,[LastPasswordChangedDate] [datetime] NOT NULL,[LastLockoutDate] [datetime] NOT NULL,[FailedPasswordAttemptCount] [int] NOT NULL,[FailedPasswordAttemptWindowStart] [datetime] NOT NULL,[FailedPasswordAnswerAttemptCount] [int] NOT NULL,[FailedPasswordAnswerAttemptWindowStart] [datetime] NOT NULL,[Comment] [ntext] NULL);
	
	INSERT @aspnet_Membership ([ApplicationId], [UserId], [Password], [PasswordFormat], [PasswordSalt], [MobilePIN], [Email], [LoweredEmail], [PasswordQuestion], [PasswordAnswer], [IsApproved], [IsLockedOut], [CreateDate], [LastLoginDate], [LastPasswordChangedDate], [LastLockoutDate], [FailedPasswordAttemptCount], [FailedPasswordAttemptWindowStart], [FailedPasswordAnswerAttemptCount], [FailedPasswordAnswerAttemptWindowStart], [Comment]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'868d40f4-2440-4053-bed9-08fcd1db0cf9', N'cRDtpNCeBiql5KOQsKVyrA0sAiA=', 0, N'', NULL, N'admin@esi.com', N'admin@esi.com', NULL, NULL, 1, 0, CAST(0x00009FD5008F280C AS DateTime), CAST(0x00009FE2006B61C4 AS DateTime), CAST(0x00009FD5008F280C AS DateTime), CAST(0xFFFF2FB300000000 AS DateTime), 0, CAST(0xFFFF2FB300000000 AS DateTime), 0, CAST(0xFFFF2FB300000000 AS DateTime), NULL)
	INSERT @aspnet_Membership ([ApplicationId], [UserId], [Password], [PasswordFormat], [PasswordSalt], [MobilePIN], [Email], [LoweredEmail], [PasswordQuestion], [PasswordAnswer], [IsApproved], [IsLockedOut], [CreateDate], [LastLoginDate], [LastPasswordChangedDate], [LastLockoutDate], [FailedPasswordAttemptCount], [FailedPasswordAttemptWindowStart], [FailedPasswordAnswerAttemptCount], [FailedPasswordAnswerAttemptWindowStart], [Comment]) VALUES (N'e966bd79-928a-45f9-9357-0596545f188e', N'837e6465-14eb-4822-b70d-0a4a9261cf37', N'2kklds#@432ds2@#@Ssds', 0, N'', NULL, N'cmsoperatoruser', N'cmsoperatoruser', NULL, NULL, 1, 0, CAST(0x00009FE1006D9200 AS DateTime), CAST(0x00009FE100F8921D AS DateTime), CAST(0x00009FE1006D9D08 AS DateTime), CAST(0xFFFF2FB300000000 AS DateTime), 0, CAST(0xFFFF2FB300000000 AS DateTime), 0, CAST(0xFFFF2FB300000000 AS DateTime), NULL)

	MERGE INTO [dbo].[aspnet_Membership] AS TARGET  
	USING @aspnet_Membership AS SOURCE  
	ON TARGET.[UserId] = SOURCE.[UserId]
	WHEN MATCHED THEN
	UPDATE SET [Password] = SOURCE.[Password]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([ApplicationId], [UserId], [Password], [PasswordFormat], [PasswordSalt], [MobilePIN], [Email], [LoweredEmail], [PasswordQuestion], [PasswordAnswer], [IsApproved], [IsLockedOut], [CreateDate], [LastLoginDate], [LastPasswordChangedDate], [LastLockoutDate], [FailedPasswordAttemptCount], [FailedPasswordAttemptWindowStart], [FailedPasswordAnswerAttemptCount], [FailedPasswordAnswerAttemptWindowStart], [Comment])   
	VALUES (SOURCE.[ApplicationId], SOURCE.[UserId], SOURCE.[Password], SOURCE.[PasswordFormat], SOURCE.[PasswordSalt], SOURCE.[MobilePIN], SOURCE.[Email], SOURCE.[LoweredEmail], SOURCE.[PasswordQuestion], SOURCE.[PasswordAnswer], SOURCE.[IsApproved], SOURCE.[IsLockedOut], SOURCE.[CreateDate], SOURCE.[LastLoginDate], SOURCE.[LastPasswordChangedDate], SOURCE.[LastLockoutDate], SOURCE.[FailedPasswordAttemptCount], SOURCE.[FailedPasswordAttemptWindowStart], SOURCE.[FailedPasswordAnswerAttemptCount], SOURCE.[FailedPasswordAnswerAttemptWindowStart], SOURCE.[Comment])  	
	OUTPUT $action, SOURCE.*;

	--07
	SET IDENTITY_INSERT [dbo].[BackOffice_Operators] ON
	
	DECLARE @BackOffice_Operators TABLE ([MembershipUserId] uniqueidentifier NOT NULL,[OperatorUserId] int not null , [FirstName] NVARCHAR(100) NULL, [LastName] NVARCHAR(100) NULL,  [MobilePhone] NVARCHAR(50) NULL, [IsGlobalAdministrator] bit NOT NULL);

	INSERT @BackOffice_Operators ( [MembershipUserId],[OperatorUserId], [FirstName], [LastName],[MobilePhone], [IsGlobalAdministrator]) VALUES (N'868d40f4-2440-4053-bed9-08fcd1db0cf9',1, N'Admin', N'Admin',N'0' , 1)
	INSERT @BackOffice_Operators ( [MembershipUserId],[OperatorUserId], [FirstName], [LastName], [MobilePhone], [IsGlobalAdministrator]) VALUES (N'837e6465-14eb-4822-b70d-0a4a9261cf37',2,  N'CmsOperatorUser', N'CmsOperatorUser', N'0', 1)

	MERGE INTO [dbo].[BackOffice_Operators] AS TARGET  
	USING @BackOffice_Operators AS SOURCE  
	ON TARGET.[MembershipUserId] = SOURCE.[MembershipUserId]
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([MembershipUserId],[OperatorUserId], [FirstName], [LastName], [MobilePhone], [IsGlobalAdministrator])   
	VALUES (SOURCE.[MembershipUserId],SOURCE.[OperatorUserId], [FirstName], SOURCE.[LastName], SOURCE.[MobilePhone], SOURCE.[IsGlobalAdministrator])  
	OUTPUT $action, SOURCE.*;
	
	SET IDENTITY_INSERT [dbo].[BackOffice_Operators] OFF
	
	--08
	DECLARE @Panel_Groups TABLE (GroupId INT NOT NULL, [GroupName] NVARCHAR(300)  NULL, [GroupLogoUrl] NVARCHAR(100) NULL, [GroupCssPrefix] NVARCHAR(100) NULL,[PanelOfflineNotificationActivated] BIT NOT NULL ,PasswordPolicyIdentifier nvarchar(50) NOT NULL,DefaultServicePackageId INT NULL);

	INSERT @Panel_Groups (GroupId, [GroupName], [GroupLogoUrl], [GroupCssPrefix],[PanelOfflineNotificationActivated] ,[PasswordPolicyIdentifier], [DefaultServicePackageId]) VALUES (0, N'Default', NULL, NULL,1, N'DefaultPolicy',1)
	INSERT @Panel_Groups (GroupId, [GroupName], [GroupLogoUrl], [GroupCssPrefix],[PanelOfflineNotificationActivated] ,[PasswordPolicyIdentifier], [DefaultServicePackageId]) VALUES (1, N'Beta Site', NULL, NULL,1, N'DefaultPolicy',3)

	MERGE INTO [dbo].[Panel_Groups] AS TARGET  
	USING @Panel_Groups AS SOURCE  
	ON TARGET.GroupId = SOURCE.GroupId
	
	WHEN MATCHED THEN 
	UPDATE SET 
	TARGET.[GroupName] = SOURCE.[GroupName],
	TARGET.[GroupLogoUrl] = SOURCE.[GroupLogoUrl],
	TARGET.[GroupCssPrefix] = SOURCE.[GroupCssPrefix],
	TARGET.[PanelOfflineNotificationActivated] = SOURCE.[PanelOfflineNotificationActivated],
	TARGET.[PasswordPolicyIdentifier] = SOURCE.[PasswordPolicyIdentifier],
	TARGET.[DefaultServicePackageId] = SOURCE.[DefaultServicePackageId]
	
	WHEN NOT MATCHED BY TARGET THEN 
	INSERT (GroupId, [GroupName], [GroupLogoUrl], [GroupCssPrefix],[PanelOfflineNotificationActivated],[PasswordPolicyIdentifier],[DefaultServicePackageId])   
	VALUES (SOURCE.GroupId, SOURCE.[GroupName], SOURCE.[GroupLogoUrl], SOURCE.[GroupCssPrefix], SOURCE.[PanelOfflineNotificationActivated],SOURCE.[PasswordPolicyIdentifier], SOURCE.[DefaultServicePackageId])  
	OUTPUT $action, SOURCE.*;

	
	--09
	DECLARE @Groups_BackOfficeOperators TABLE ([GroupId] INT NOT NULL, [OperatorId] INT NOT NULL, [IsRemoteBootAllowed] bit NOT NULL, [IsReportsAllowed] bit NOT NULL, [IsCustomerSupportAllowed]  bit NOT NULL, [IsUserManagementAllowed]  bit NOT NULL, [IsPanelsRegistrationAllowed] bit NOT NULL, [IsSuspendPanels] bit NOT NULL, [IsResetToFactory] bit NOT NULL, [IsCommands] bit NOT NULL);

	INSERT @Groups_BackOfficeOperators ([GroupId], [OperatorId], [IsRemoteBootAllowed], [IsReportsAllowed], [IsCustomerSupportAllowed], [IsUserManagementAllowed], [IsPanelsRegistrationAllowed], [IsSuspendPanels], [IsResetToFactory], [IsCommands]) VALUES (0, 1, 1, 1, 1, 1, 1, 1, 1, 1)
	INSERT @Groups_BackOfficeOperators ([GroupId], [OperatorId], [IsRemoteBootAllowed], [IsReportsAllowed], [IsCustomerSupportAllowed], [IsUserManagementAllowed], [IsPanelsRegistrationAllowed], [IsSuspendPanels], [IsResetToFactory], [IsCommands]) VALUES (1, 2, 0, 0, 0, 0, 0, 0 ,0, 0)

	MERGE INTO [dbo].[Groups_BackOfficeOperators] AS TARGET  
	USING @Groups_BackOfficeOperators AS SOURCE  
	ON TARGET.GroupId = SOURCE.GroupId and TARGET.[OperatorId] = SOURCE.[OperatorId]
	
	WHEN MATCHED THEN 
	UPDATE SET 
	TARGET.[IsRemoteBootAllowed] = SOURCE.[IsRemoteBootAllowed], 
	TARGET.[IsReportsAllowed] = SOURCE.[IsReportsAllowed], 
	TARGET.[IsCustomerSupportAllowed] = SOURCE.[IsCustomerSupportAllowed], 
	TARGET.[IsUserManagementAllowed] = SOURCE.[IsUserManagementAllowed], 
	TARGET.[IsPanelsRegistrationAllowed] = SOURCE.[IsPanelsRegistrationAllowed], 
	TARGET.[IsSuspendPanels] = SOURCE.[IsSuspendPanels], 
	TARGET.[IsResetToFactory] = SOURCE.[IsResetToFactory],
	TARGET.[IsCommands] = SOURCE.[IsCommands]
	
	WHEN NOT MATCHED BY TARGET THEN   
	INSERT ([GroupId], [OperatorId], [IsRemoteBootAllowed], [IsReportsAllowed], [IsCustomerSupportAllowed], [IsUserManagementAllowed], [IsPanelsRegistrationAllowed],[IsSuspendPanels], [IsResetToFactory], [IsCommands] )   
	VALUES (SOURCE.[GroupId], SOURCE.[OperatorId], SOURCE.[IsRemoteBootAllowed], SOURCE.[IsReportsAllowed], SOURCE.[IsCustomerSupportAllowed], SOURCE.[IsUserManagementAllowed], SOURCE.[IsPanelsRegistrationAllowed], SOURCE.[IsSuspendPanels], SOURCE.[IsResetToFactory], SOURCE.[IsCommands] )
	OUTPUT $action, SOURCE.*;
	
	