Hello, colleagues,

has anyone tried and tested migration from TS 3.3.1 to TS 3.4.0 in the way, when only binary files are replaced from 3.3.1 to 3.4.0 and tbl_DatabaseInfo is updated? The same way, which is discribed for 3.3.2. -> 3.4.0 at https://community.terrasoft.ua/blogs/6982.

Нравится

11 комментариев

А лицензии у вас 3.4 или 3.3? Я пытался запустить 3.3.2 базу на 3.4 бинарниках, но не получилось, так как лицензии должны быть на 3.4.

Yes, You have to have 3.4 licenses and load them, when running 3.4 binaries with 3.3.2 database. We tried it in one project - it works.

Customer, who has 3.3.1, will buy 3.4 licenses, only the question is if 3.4 binaries can work with 3.3.1 database. Before buying, we have to try and test. Maybe someone already did it? :)

Hello Aurimas,
Personally I didn't solve this task, but one of our client had an experience. He had an issue with integrating with Outlook, and the problem was that macroses didn't work correctly. As I remember the solution was to update services which reply to Outlook integration from 3.4.0 version.
About other his problems after updating tbl_DatabaseInfo I don't know

Hello,

I could not run 3.3.1 database with 3.4.0.113 binaries.

I added DatabaseBuildVersion to tbl_DatabaseInfo and updated.

UPDATE [tbl_DatabaseInfo] SET
      [DatabaseMajorVersion] = 3,
      [DatabaseMinorVersion] = 4,
      [DatabaseReleaseVersion] = 0,
      [DatabaseBuildVersion] = 113

When running 3.4.0 License manager, I get this error:

Does it mean, that application should be upgraded from 3.3.1 to 3.3.2 first?

3.3.1 does not have DatabaseBuildVersion column in tbl_DatabaseInfo table so you will have to add it manually too:

ALTER TABLE tbl_DatabaseInfo  
ADD DatabaseBuildVersion INT NULL 
 
update tbl_DatabaseInfo
set DatabaseBuildVersion = 1

Yes, I added this column before I ran 3.4.0 binaires, but the result is the same.

I think you should update service 'tbl_DatabaseInfo' or just load this service from 3.4.0 original database into your database tbl_databaseinfo.rar
Don't forget to make a reserve copy of your current 'tbl_DatabaseInfo' service

Hello Aurimas, there is the difference in stored procedure tsp_GetLoginInfo which cause an error you faced, you shoud update it from 3.4.0 this would add missing column @DatabaseBuildVersion in it's body and Terrasoft will run after you add products JobManager and Dictionary in LicenseManager
And previous comment by Александр Кудряшов is also right

ALTER procedure [dbo].[tsp_GetLoginInfo](
	@UserName sysname)
as
begin
	/*
	** Get Login Info.
	*/
	if (@UserName = '') 
	begin
		set @UserName = SYSTEM_USER
	end
 
	set nocount on
 
	if ((is_srvrolemember('sysadmin') <> 1 or is_member('db_owner') <> 1) and (@UserName <> SYSTEM_USER))
	begin
		goto result
	end		
 
	/*
	** Declarations.
	*/
	declare @DatabaseID uniqueidentifier
	declare @ParentDatabaseID uniqueidentifier
	declare @DatabaseMajorVersion int
	declare @DatabaseMinorVersion int
	declare @DatabaseReleaseVersion int
	declare @UseCache int
	declare @ServiceModifiedOn datetime
	declare @ServiceDeletedOn datetime
	declare @ServerSessionsInfo nvarchar(2000)
	declare @UserID uniqueidentifier
	declare	@ContactUserName nvarchar(250)
	declare	@AccountContactUserName  nvarchar(250)
	declare @UserContactID uniqueidentifier
	declare @UserAccountID uniqueidentifier
	declare @UserIsEnabled int
	declare @UserPasswordNeverExpired int
	declare @UserPasswordChangedOn datetime
	declare @UserIsAdmin int
	declare @UserIsSysAdmin int
	declare @GroupPasswordChangePeriodType int
	declare @CustomerID nvarchar(250)
	declare @TimeZone nvarchar(250)
	declare @DatabaseBuildVersion int
 
	exec [dbo].[tsp_LoadUserAdminUnit]  @AUserName = @UserName
 
	select
		@DatabaseID = [ID],
		@ParentDatabaseID = [ParentID],
		@DatabaseMajorVersion = [DatabaseMajorVersion],
		@DatabaseMinorVersion = [DatabaseMinorVersion],
		@DatabaseReleaseVersion = [DatabaseReleaseVersion],
		@DatabaseBuildVersion = [DatabaseBuildVersion],
		@UseCache = [UseCache],
		@ServiceModifiedOn = [ServiceModifiedOn],
		@ServiceDeletedOn = [ServiceDeletedOn],
		@ServerSessionsInfo = [ServerSessionsInfo]
	from [dbo].[tbl_DatabaseInfo]
 
	select 		
		@UserID = [u].[ID],
		@UserContactID = [u].[UserContactID],
		@UserIsEnabled = [u].[UserIsEnabled],
		@UserPasswordNeverExpired = [u].[UserPasswordNeverExpired],
		@UserPasswordChangedOn = [u].[UserPasswordChangedOn],
		@ContactUserName = [c].[Name], 
		@UserAccountID = [c].[AccountID],
		@AccountContactUserName = [a].[Name],
		@TimeZone = [c].[TimeZone]
	from [dbo].[tbl_AdminUnit] [u]
	left join [dbo].[tbl_Contact] [c] on [c].[ID] = [u].[UserContactID]
	left join [dbo].[tbl_Account] [a] on [a].[ID] = [c].[AccountID]
	where [u].[Name] = @UserName
	and isnull([u].[IsGroup], 0) = 0
 
	set @UserIsSysAdmin = isnull(is_srvrolemember('sysadmin', @UserName), 0)
 
	if @UserIsSysAdmin = 1 
	begin
		set @UserIsAdmin = 1
	end else
	begin
		if exists(select * from sysmembers
			where groupuid = user_id('db_owner')
			and memberuid = user_id(@UserName))
		begin
			set @UserIsAdmin = 1
		end else
		begin
			set @UserIsAdmin = 0
		end	
	end
 
	if (isnull(@UserPasswordNeverExpired,0) <> 1)
	begin
		SELECT 
			@GroupPasswordChangePeriodType = MAX([AdminUnit].[GroupPasswordChangePeriodType]) 
		FROM [dbo].[tbl_AdminUnit] as [AdminUnit]
		WHERE (isnull([AdminUnit].[IsGroup],0) = 1)
		  AND ([AdminUnit].[ID] in (
			  SELECT DISTINCT [UserAdminUnit].[AdminUnitID]
				FROM [dbo].[tbl_UserAdminUnit] as [UserAdminUnit]
				WHERE ([UserAdminUnit].[UserName] = @UserName)))
	end else
	begin
		set @GroupPasswordChangePeriodType = 5
	end
 
	select 
		@CustomerID = [StringValue]
	from [dbo].[tbl_SystemSetting]
	where [Code] = 'CustomerID'
 
	declare @version int
	set @version = @@microsoftversion /0x01000000
 
	if (@version > 8)   
	begin
		if (object_id('[dbo].[tsp_fkeys]', 'P') is null) and (@UserIsSysAdmin = 0)
		begin
			raiserror ('User with sysadmin right must to login first.', 17, 1)
			goto result
		end
 
		if (@UserIsSysAdmin = 0)
		begin
			goto result
		end
 
		declare @sql nvarchar(4000)
 
		if not exists(select * from master.dbo.syslogins where name = 'fkeys')
		begin			
			set @sql = 'create login [fkeys] with password = ''' + cast(newid() as varchar(38)) + ''', check_policy = off '
			exec(@sql)
 
			if (not object_id('[dbo].[tsp_fkeys]', 'P') is null)
			begin
				exec('drop procedure [dbo].[tsp_fkeys]')
			end
 
			if exists(select * from sysusers where name = 'fkeys')
			begin
				exec('drop user [fkeys]')
			end
		end
		if not exists(select * from sysusers where name = 'fkeys')
		begin
			exec('create user [fkeys] for login [fkeys]')
		end
 
		exec sp_addrolemember 'db_owner', 'fkeys'
 
		declare @loginsid varbinary(85)
 
		set @loginsid = (select sid from master.dbo.syslogins where
                	loginname = 'fkeys' and isntname = 0)
 
		if exists (select * from sysusers where name = 'fkeys' and issqluser = 1
                	and sid <> @loginsid)
		begin
			exec sp_change_users_login 'update_one', 'fkeys', 'fkeys'
		end
 
		if object_id('[dbo].[tsp_fkeys]', 'P') is null		    
		begin
			set @sql = ' create procedure [dbo].[tsp_fkeys](' + char(13) +
			 ' @pktable_name		sysname = null, ' + char(13) +
			 ' @pktable_owner		sysname = null, ' + char(13) +
			 ' @pktable_qualifier	sysname = null, ' + char(13) +
			 ' @fktable_name		sysname = null, ' + char(13) +
			 ' @fktable_owner		sysname = null, ' + char(13) +
			 ' @fktable_qualifier	sysname = null ) ' + char(13) +
			 ' with execute as ''fkeys'' ' + char(13) +
			 ' as ' + char(13) +
			 ' begin ' + char(13) +
			 '   exec [sp_fkeys] @pktable_name, @pktable_owner, @pktable_qualifier, ' + char(13) +
			 '   @fktable_name, @fktable_owner, @fktable_qualifier ' + char(13) +
			 ' end'
			exec (@sql)
			grant execute on [dbo].[tsp_fkeys] to public
		end
                if object_id('[dbo].[tsp_GetIsObjectExists]', 'P') is null		    
	        begin
		set @sql = ' create procedure [dbo].[tsp_GetIsObjectExists] ' + char(13) +
                       '  @ObjectName nvarchar(80), ' + char(13) +
                       '  @SQLObjectName nvarchar(2) ' + char(13) +
                       ' with execute as ''fkeys'' ' + char(13) +
                       ' AS ' + char(13) +
                       ' BEGIN ' + char(13) +
	                   '   select Count(*) ' + char(13) +
                       '     from [sysobjects] ' + char(13) +
                       '    where name = @ObjectName ' + char(13) +
                       '      and type = @SQLObjectName ' + char(13) +
                       ' END '
			exec (@sql)
			grant execute on [dbo].[tsp_GetIsObjectExists] to public
		end
	end
 
	result:
	select 
		getdate() AS [LoginDateTime],
		@DatabaseID as [DatabaseID],
		@ParentDatabaseID as [ParentDatabaseID],
		@DatabaseMajorVersion as [DatabaseMajorVersion],
		@DatabaseMinorVersion as [DatabaseMinorVersion],
		@DatabaseReleaseVersion as [DatabaseReleaseVersion],
		@DatabaseBuildVersion as [DatabaseBuildVersion],
		@UseCache as [UseCache],
		@ServiceModifiedOn as [ServiceModifiedOn],
		@ServiceDeletedOn as [ServiceDeletedOn],
		@ServerSessionsInfo as [ServerSessionsInfo],
		@UserID as [UserID],
		@UserName as [UserName], 
		@UserContactID as [UserContactID],
		@ContactUserName as [ContactName],
		@UserAccountID as [AccountID],
		@AccountContactUserName as [AccountName],
		@UserIsEnabled as [UserIsEnabled],
		@UserPasswordNeverExpired AS [UserPasswordNeverExpired],
		@GroupPasswordChangePeriodType as [GroupPasswordChangePeriodType],
		@UserPasswordChangedOn as [UserPasswordChangedOn],
		@UserIsAdmin as [UserIsAdmin],
		@UserIsSysAdmin as [UserIsSysAdmin],
		@CustomerID as [CustomerID],
		@TimeZone as [TimeZone]		
end

Aslo you will see the other problem after such migration. At first run you will see that Workspace will not initialize
1
And after switching the section workspace will appear correctly
The reason of this behavior is difference in Initialize functions in scr_Main

Solution
In scr_Main edit function amiAccountsOnExecute
Add

	var CurrentWorkspaceWindow = wndWorkspace.Window;
		if (CurrentWorkspaceWindow) {
		StopOrRefreshWebDetail(CurrentWorkspaceWindow, false);
		}

insead of

	    var CurrentWorkspaceWindow = wndWorkspace.Window;
	    if (!CurrentWorkspaceWindow) {
	        return;            
	    }
	    StopOrRefreshWebDetail(CurrentWorkspaceWindow, false);

In result you will get:

function amiAccountsOnExecute(ActionMenuItem) {    
	var WorkspaceUSI = ActionMenuItem.Tag;
    var DoRefreshWorkspace = (Main.WorkspaceUSI == WorkspaceUSI);
    if (!DoRefreshWorkspace) {
//	    var CurrentWorkspaceWindow = wndWorkspace.Window;
//	    if (!CurrentWorkspaceWindow) {
//	        return;            
//	    }
		var CurrentWorkspaceWindow = wndWorkspace.Window;
		if (CurrentWorkspaceWindow) {
		StopOrRefreshWebDetail(CurrentWorkspaceWindow, false);
		}
 
	    //StopOrRefreshWebDetail(CurrentWorkspaceWindow, false);
    }
    ShowWorkspace(WorkspaceUSI);
....

In my case I tried to update binaries from 3.3.1 XRM+ServiceDesk. in XRM 3.3.1 you had the section called OfferingMovement
1
In 3.4.0 this section moved to XRM Distribution therefore you will have to buy this product (OfferingMovement) seperately

Thank You, I will try these changes.

Показать все комментарии