

--  ------------  Generated from [/big2/11.0/Build80_SP24/cxunix/source/CommServer/AppStudioDB/Upgrade/WF_Extended_Properties.upg] ---------- 

BEGIN

DECLARE @oldRev CHAR(20)    		
  	DECLARE @oldVal CHAR(256)			
  	DECLARE @retCode   INTEGER			
  	DECLARE @sqlError  INTEGER			
  	SET     @retCode = 0              	
  	DECLARE @sqlString nvarchar(MAX)	
  	DECLARE @macroValue nvarchar(MAX)	
      DECLARE @parentID INTEGER				
      DECLARE @tName nvarchar(128)			
      DECLARE @colID INTEGER					
      DECLARE @constId INTEGER				
      DECLARE @cName   nvarchar(128)			
  	DECLARE @oldConstraintName   nvarchar(128)	
  	DECLARE @newConstraintName   nvarchar(128)	
  	DECLARE @oldDataType         nvarchar(64)	
  	DECLARE @keyname   nvarchar(128)		
      DECLARE @dbName   nvarchar(128)			
  	DECLARE @IsNullableAttr VARCHAR(100)	
  	DECLARE @DefaultValAttr NVARCHAR(MAX)	
  	DECLARE @DataType     NVARCHAR(	256)	
  	DECLARE @ct_msg			VARCHAR(1024) = ''	
  	DECLARE @ct_tcMsg		VARCHAR(1024) = ''	
  	DECLARE @nl				VARCHAR(3) = CHAR(13) + CHAR(10)	
  	SET ROWCOUNT 0							
  	SET NOCOUNT ON--   Declare/Initialize @oldRev, @oldVal, @retCode

SELECT @dbName = DB_NAME()													
  SELECT @oldRev = (SELECT revision FROM GXDBVersions WHERE name = 'WF_Extended_Properties')	
  IF (@oldRev IS NULL)														
  BEGIN                 														
      SET @oldRev = '0.0'														
  END																			
  IF NOT EXISTS (SELECT * FROM sysobjects										
  WHERE type = 'U'															
  AND name = 'WF_Extended_Properties')														
  BEGIN																		
  	SET @oldRev = '0.0'														
  	DELETE FROM GXDBVersions WHERE name = 'WF_Extended_Properties'							
  END																			
  IF (@oldRev = '1.1')       												
  BEGIN																		
      PRINT 'RETVAL: 0   Table [' +'WF_Extended_Properties' +'] does NOT require upgrade.'	
  	
  END																			
  else																		
  BEGIN																		
      PRINT 'Upgrading Table [' +'WF_Extended_Properties' +'].'							
  END


IF NOT EXISTS (select * from sysobjects where id = object_id(N'[dbo].[WF_Extended_Properties]') and OBJECTPROPERTY(id, N'IsTable') = 1)
BEGIN



--  ------------  Generated from [/big2/11.0/Build80_SP24/cxunix/source/CommServer/AppStudioDB/Tbl/WF_Extended_Properties.tbl] ---------- 





-- ALLOW_COMMENTS_BELOW_HERE:

-- ----------------------------------------------------------------------

--

--           Copyright (c) 1998  CommVault Systems, Inc.

--                  All rights reserved.

--

--

--        This is unpublished proprietary source code of CommVault

--        Systems, Inc. The copyright notice above does not evidence

--        any actual or intended publication of such source code.

-- ----------------------------------------------------------------------*/

-- rcsid="@(#)$Source: /cvs/cvsrepro/GX/vaultcx/Source/CommServer/AppStudioDB/Tbl/WF_Extended_Properties.tbl,v $ $Id: WF_Extended_Properties.tbl,v 1.3.4.2 2021/06/16 12:23:19 manvendrakumar Exp $";

print '... Creating Table: WF_Extended_Properties'

exec ('



DECLARE @tblRetCode integer

Set NOCOUNT ON





create table WF_Extended_Properties (

	[Sys_Id] int IDENTITY(1,1)NOT NULL,

	[ClientHostName] nvarchar(512) NOT NULL,

	[DatasourceName] nvarchar(512) NOT NULL,

	[SharePath]				nvarchar(max)NULL,

	[Country] nvarchar(255) NULL,

	[UserName] nvarchar(255) NULL,

	[Password] nvarchar(255) NULL,

	[DCPlan] nvarchar(255) NULL,

	[AccessNode] nvarchar(255) NULL,

	[ArchivingPlan] nvarchar(255) NULL,

	[BackedupStatus] int  NULL,

	[CrawlType] int  NULL,

	[Created] int DEFAULT DATEDIFF(SECOND,''1970-01-01'', GETUTCDATE()),

	[Modified] int DEFAULT 0	NOT NULL,

	[Status] int DEFAULT -1	NOT NULL,

	[Sys_DataSourceId] int NULL,

	[Sys_CreationTime] datetime NULL,

	[Sys_ErrorMessage]				nvarchar(max) NULL



) 

set @tblRetCode = @@error

if (@tblRetCode <> 0)

BEGIN

		set @tblRetCode = @@error;

		print ''RETVAL: 10 Table [WF_Extended_Properties]''

END

--------





ALTER TABLE WF_Extended_Properties ADD CONSTRAINT  [PK_DataSources_Input_AZ] PRIMARY KEY NONCLUSTERED ([ClientHostName] ASC,[DatasourceName] ASC)

 

                

set @tblRetCode = @@error

if (@tblRetCode <> 0)

BEGIN

	set @tblRetCode = @@error;

	print ''RETVAL: 99 Table [WF_Extended_Properties]''

END

-----------------------------------------------------



Create INDEX WF_Extended_Properties_Sys_DataSourceId on WF_Extended_Properties(Sys_DataSourceId)

 

set @tblRetCode = @@error 

if (@tblRetCode <> 0)

BEGIN

	set @tblRetCode = @@error;

	print ''RETVAL: 02 Table [WF_Extended_Properties]''

END

----------



insert into GXDBVersions values(1, ''WF_Extended_Properties'',  ''1.3.4.2'', ''WF_Extended_Properties'', '''')

set @tblRetCode = @@error

if (@tblRetCode <> 0)

BEGIN

	set @tblRetCode = @@error;

	print ''RETVAL: 10 Table [GXDBVersions]''

END

-------------------------------------------------------------




')
END
IF (@retCode < 10)													
  	BEGIN																
  		IF NOT EXISTS (SELECT * FROM GXDBVersions WHERE name = 'WF_Extended_Properties')			
  			insert into GXDBVersions VALUES(1, 'WF_Extended_Properties', '0.0', 'WF_Extended_Properties', '')	
  			UPDATE GXDBVersions SET revision = '1.1' WHERE name = 'WF_Extended_Properties'		
   PRINT 'RETVAL: ' + CONVERT(CHAR(3), @retCode) + 'Table [' + 'WF_Extended_Properties' + '] upgraded successfully to '			+ ' revision [' + '1.1' + '].'										
  	END																	
  	else																
  		PRINT 'RETVAL: ' + CONVERT(CHAR(5), @retCode) + ' TABLE ' + 'WF_Extended_Properties' + ' Upgrade Completed with Errors.'  
  	RETURN			   -- No more upgrade for this TABLE!-- Update cvTable & return

END

GO
IF @@error <> 0 RETURN
GO
