Skip to content

Commit

Permalink
Add $ForceInstallation parameter to Start-SqlSizerSession
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-golebiowski committed Oct 28, 2022
1 parent f294c09 commit be11a57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Examples/AdventureWorks2019_example_01.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ $connection = New-SqlConnectionInfo -Server $server -Username $username -Passwor
$info = Get-DatabaseInfo -Database $database -ConnectionInfo $connection -MeasureSize $true

# Start session
$sessionId = Start-SqlSizerSession -Database $database -ConnectionInfo $connection -DatabaseInfo $info
$sessionId = Start-SqlSizerSession -Database $database -ConnectionInfo $connection -DatabaseInfo $info -ForceInstallation $true

# Define start set
# Query 1: 10 persons with first name = 'John'
Expand Down
7 changes: 5 additions & 2 deletions SqlSizer-MSSQL/Public/Start-SqlSizerSession.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ function Start-SqlSizerSession
[Parameter(Mandatory = $true)]
[DatabaseInfo]$DatabaseInfo,

[Parameter(Mandatory = $false)]
[bool]$ForceInstallation = $false,

[Parameter(Mandatory = $true)]
[SqlConnectionInfo]$ConnectionInfo
)
Expand All @@ -18,8 +21,8 @@ function Start-SqlSizerSession

Write-Host "SqlSizer: Installation verification"

# install sql sizer if not installed
Install-SqlSizer -Database $Database -ConnectionInfo $ConnectionInfo -DatabaseInfo $DatabaseInfo -SessionId $sessionId
# install SqlSizer if not installed
Install-SqlSizer -Database $Database -ConnectionInfo $ConnectionInfo -DatabaseInfo $DatabaseInfo -SessionId $sessionId -Force $ForceInstallation

# save session id
$sql = "INSERT INTO SqlSizer.Sessions(SessionId) VALUES('$SessionId')"
Expand Down

0 comments on commit be11a57

Please sign in to comment.