-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Merge Blitz.ps1 so not hardcoded to directory path
This change updates the script such that it'll run on other peoples' machines, even when they don't have a folder path that is specific to Brent's developer machine.
- Loading branch information
1 parent
fbc68d6
commit 7c09213
Showing
1 changed file
with
17 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,28 @@ | ||
#Set your file path | ||
$FilePath = "/Users/brentozar/LocalOnly/Github/SQL-Server-First-Responder-Kit" | ||
$SqlVersionsPath = "$FilePath/SqlServerVersions.sql" | ||
$BlitzFirstPath = "$FilePath/sp_BlitzFirst.sql" | ||
$RepoRootPath = $PSScriptRoot | ||
$RepoRootPath = Join-Path -Path $RepoRootPath -ChildPath ".." | ||
$RepoRootPath = Join-Path -Path $RepoRootPath -ChildPath ".." | ||
$RepoRootPath = Resolve-Path -Path $RepoRootPath | ||
|
||
$SqlVersionsPath = "$RepoRootPath/SqlServerVersions.sql" | ||
$BlitzFirstPath = "$RepoRootPath/sp_BlitzFirst.sql" | ||
|
||
#Azure - skip sp_Blitz, sp_BlitzBackups, sp_DatabaseRestore, sp_ineachdb | ||
Get-ChildItem -Path "$FilePath" -Filter "sp_Blitz*.sql" | | ||
Get-ChildItem -Path "$RepoRootPath" -Filter "sp_Blitz*.sql" | | ||
Where-Object { $_.FullName -notlike "*sp_Blitz.sql*" -and $_.FullName -notlike "*sp_BlitzBackups*" -and $_.FullName -notlike "*sp_DatabaseRestore*"} | | ||
ForEach-Object { Get-Content $_.FullName } | | ||
Set-Content -Path "$FilePath/Install-Azure.sql" -Force | ||
ForEach-Object { Get-Content $_.FullName } | | ||
Set-Content -Path "$RepoRootPath/Install-Azure.sql" -Force | ||
if ( test-path "$BlitzFirstPath") | ||
{ Add-Content -Path "$FilePath/Install-All-Scripts.sql" -Value (Get-Content -Path "$BlitzFirstPath")} | ||
{ Add-Content -Path "$RepoRootPath/Install-All-Scripts.sql" -Value (Get-Content -Path "$BlitzFirstPath")} | ||
|
||
|
||
#All Scripts | ||
Get-ChildItem -Path "$FilePath" -Filter "sp_*.sql" | | ||
Get-ChildItem -Path "$RepoRootPath" -Filter "sp_*.sql" | | ||
Where-Object { $_.FullName -notlike "*sp_BlitzInMemoryOLTP*" -and $_.FullName -notlike "*sp_BlitzFirst*"} | | ||
ForEach-Object { Get-Content $_.FullName } | | ||
Set-Content -Path "$FilePath/Install-All-Scripts.sql" -Force | ||
ForEach-Object { Get-Content $_.FullName } | | ||
Set-Content -Path "$RepoRootPath/Install-All-Scripts.sql" -Force | ||
#append script to (re-)create SqlServerVersions Table (https://github.com/BrentOzarULTD/SQL-Server-First-Responder-Kit/issues/2429) | ||
if ( test-path "$SqlVersionsPath") | ||
{ Add-Content -Path "$FilePath/Install-All-Scripts.sql" -Value (Get-Content -Path "$SqlVersionsPath")} | ||
{ Add-Content -Path "$RepoRootPath/Install-All-Scripts.sql" -Value (Get-Content -Path "$SqlVersionsPath")} | ||
if ( test-path "$BlitzFirstPath") | ||
{ Add-Content -Path "$FilePath/Install-All-Scripts.sql" -Value (Get-Content -Path "$BlitzFirstPath")} | ||
{ Add-Content -Path "$RepoRootPath/Install-All-Scripts.sql" -Value (Get-Content -Path "$BlitzFirstPath")} |