Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Merge Blitz.ps1 so not hardcoded to directory path #3595

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions Documentation/Development/Merge Blitz.ps1
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")}
Loading