text: SET NOCOUNT ON
  /*
  *-----------------------------------------------------------------------------*
  * dbaTDPMon (Troubleshoot Database Performance / Monitoring)                  *
  * https://github.com/rentadba/dbaTDPMon, under GNU (GPLv3) licence model      *
  *-----------------------------------------------------------------------------*
  * Patch script: from version 2020.01 to 2021.02 (2021.02.15)				  *
  *-----------------------------------------------------------------------------*
  */
  
  /*---------------------------------------------------------------------------------------------------------------------*/
  /* patch module: common																								   */
  /*---------------------------------------------------------------------------------------------------------------------*/
  RAISERROR('* Patch: 20210215-patch-upgrade-from-v2020_01-to-v2021_02-common.sql', 10, 1) WITH NOWAIT
  IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[logInternalConfigurationChanges]') AND type in (N'U'))
  	begin
  		RAISERROR('Create table: [dbo].[logInternalConfigurationChanges]', 10, 1) WITH NOWAIT
  
  		CREATE TABLE [dbo].[logInternalConfigurationChanges]
  		(
  			  [id]							[int]	 IDENTITY (1, 1)	NOT NULL
  			, [instance_name]				[sysname]	NOT NULL
  			, [spid]						[smallint]	NOT NULL
  			, [option_xp_changed]			[bit]		NOT NULL DEFAULT (0)
  			, [option_advanced_changed]		[bit]		NOT NULL DEFAULT (0)
  			, [counter]						[int]		NOT NULL DEFAULT (0)
  			, [event_start_date_utc]		[datetime]	NOT NULL CONSTRAINT [DF_logInternalConfigurationChanges_event_start_date_utc] DEFAULT (GETUTCDATE())
  			, [event_end_date_utc]			[datetime]	NULL
  		);
  
  		EXEC('CREATE INDEX [IX_logInternalConfigurationChanges_InstanceID] ON [dbo].[logInternalConfigurationChanges]([instance_name], [spid], [event_end_date_utc])')
  	end
  GO
  