Skip to content

Commit

Permalink
added {CheckTitle} placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
EitanBlumin committed Sep 2, 2024
1 parent 14d4207 commit bcadbb9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
9 changes: 5 additions & 4 deletions Build_Full_CheckScript.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ $CheckFooterTemplate = [string](Get-Content -Path $CheckTemplateFooterFilePath -

Get-ChildItem -Path $CheckScriptsFolderPath -Include $CheckScriptsFilter | ForEach-Object {
$CheckId += 1
Write-Output "Check $CheckId : $($_.BaseName)"
$CheckTitle = $($_.BaseName)
Write-Output "Check $CheckId : $CheckTitle"

$OutputScriptBuilder += $batchSeparator
$OutputScriptBuilder += $CheckHeaderTemplate.Replace('{CheckId}', $CheckId)
$OutputScriptBuilder += [string](Get-Content -Path $_.FullName -Raw).Replace('{CheckId}', $CheckId)
$OutputScriptBuilder += $CheckFooterTemplate.Replace('{CheckId}', $CheckId)
$OutputScriptBuilder += $CheckHeaderTemplate.Replace('{CheckId}', $CheckId).Replace('{CheckTitle}', $CheckTitle)
$OutputScriptBuilder += [string](Get-Content -Path $_.FullName -Raw).Replace('{CheckId}', $CheckId).Replace('{CheckTitle}', $CheckTitle)
$OutputScriptBuilder += $CheckFooterTemplate.Replace('{CheckId}', $CheckId).Replace('{CheckTitle}', $CheckTitle)
}

Write-Output "Finalizing output script: $OutputScriptFilePath"
Expand Down
2 changes: 1 addition & 1 deletion SQLChecks/Auto Create Statistics is Off.sql
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
)
SELECT
CheckId = '{CheckId}' ,
Title = N'Auto Create Statistics is Off' ,
Title = N'{CheckTitle}' ,
RequiresAttention =
CASE
WHEN @AdditionalInfo IS NULL
Expand Down
2 changes: 1 addition & 1 deletion SQLChecks/Heap Tables.sql
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
)
SELECT
CheckId = '{CheckId}' ,
Title = N'Heap Tables' ,
Title = N'{CheckTitle}' ,
RequiresAttention =
CASE
WHEN @AdditionalInfo IS NULL
Expand Down
2 changes: 1 addition & 1 deletion SQLChecks/Statistics are Never Updated.sql
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
)
SELECT
CheckId = '{CheckId}' ,
Title = N'Statistics are Never Updated' ,
Title = N'{CheckTitle}' ,
RequiresAttention =
CASE
WHEN @AdditionalInfo IS NULL
Expand Down
2 changes: 1 addition & 1 deletion Template/Check_Footer.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
IsDeadlockRetry
)
SELECT
CheckId = @CheckId ,
CheckId = '{CheckId}' ,
ErrorNumber = ERROR_NUMBER () ,
ErrorMessage = ERROR_MESSAGE () ,
ErrorSeverity = ERROR_SEVERITY () ,
Expand Down
2 changes: 1 addition & 1 deletion Template/Check_Header.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DECLARE
, @DeadlockRetry AS BIT = 0


-- Check #{CheckId}
-- Check #{CheckId} : {CheckTitle}

WHILE
1 = 1
Expand Down
2 changes: 0 additions & 2 deletions Template/Template_Header.sql
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,3 @@ FROM
sys.dm_os_host_info AS HostInfo
CROSS JOIN
sys.dm_os_sys_info AS SystemInfo;

GO

0 comments on commit bcadbb9

Please sign in to comment.