@@ -83,7 +83,7 @@ function Import-BacpacToSqlServer
83
83
{
84
84
# Setting up SQL Package executable path.
85
85
$sqlPackageExecutablePath = ' '
86
- if (! [string ]::IsNullOrEmpty($SqlPackageExecutablePath ) -and (Test-Path $SqlPackageExecutablePath ))
86
+ if (-not [string ]::IsNullOrEmpty($SqlPackageExecutablePath ) -and (Test-Path $SqlPackageExecutablePath ))
87
87
{
88
88
$sqlPackageExecutablePath = $SqlPackageExecutablePath
89
89
}
@@ -122,7 +122,7 @@ function Import-BacpacToSqlServer
122
122
123
123
# Checking the validity of the bacpac file.
124
124
$bacpacFile = Get-Item $BacpacPath
125
- if ($null -eq $bacpacFile -or ! ($bacpacFile -is [System.IO.FileInfo ]) -or ! ($bacpacFile.Extension -eq ' .bacpac' ))
125
+ if ($null -eq $bacpacFile -or -not ($bacpacFile -is [System.IO.FileInfo ]) -or -not ($bacpacFile.Extension -eq ' .bacpac' ))
126
126
{
127
127
throw " The .bacpac file is not found at '$BacpacPath '!"
128
128
}
@@ -137,27 +137,27 @@ function Import-BacpacToSqlServer
137
137
$serverSegment = $connectionStringSegments | Where-Object {
138
138
$PSItem.StartsWith (' Data Source=' ) -or $PSItem.StartsWith (' Server=' )
139
139
}
140
- if (! ( [string ]::IsNullOrEmpty($serverSegment ) ))
140
+ if (-not [string ]::IsNullOrEmpty($serverSegment ))
141
141
{
142
142
$SqlServerName = $serverSegment.Split (' =' , 2 , [System.StringSplitOptions ]::RemoveEmptyEntries)[1 ]
143
143
}
144
144
145
145
$databaseSegment = $connectionStringSegments | Where-Object {
146
146
$PSItem.StartsWith (' Initial Catalog=' ) -or $PSItem.StartsWith (' Database=' )
147
147
}
148
- if (! ( [string ]::IsNullOrEmpty($databaseSegment ) ))
148
+ if (-not [string ]::IsNullOrEmpty($databaseSegment ))
149
149
{
150
150
$DatabaseName = $databaseSegment.Split (' =' , 2 , [System.StringSplitOptions ]::RemoveEmptyEntries)[1 ]
151
151
}
152
152
153
153
$UsernameSegment = $connectionStringSegments | Where-Object { $PSItem.StartsWith (' User Id=' ) }
154
- if (! ( [string ]::IsNullOrEmpty($UsernameSegment ) ))
154
+ if (-not [string ]::IsNullOrEmpty($UsernameSegment ))
155
155
{
156
156
$Username = $UsernameSegment.Split (' =' , 2 , [System.StringSplitOptions ]::RemoveEmptyEntries)[1 ]
157
157
}
158
158
159
159
$PasswordSegment = $connectionStringSegments | Where-Object { $PSItem.StartsWith (' Password=' ) }
160
- if (! ( [string ]::IsNullOrEmpty($PasswordSegment ) ))
160
+ if (-not [string ]::IsNullOrEmpty($PasswordSegment ))
161
161
{
162
162
$Password = $PasswordSegment.Split (' =' , 2 , [System.StringSplitOptions ]::RemoveEmptyEntries)[1 ]
163
163
}
@@ -189,16 +189,16 @@ function Import-BacpacToSqlServer
189
189
}
190
190
191
191
$securePassword = $null
192
- if (! [string ]::IsNullOrEmpty($Password ))
192
+ if (-not [string ]::IsNullOrEmpty($Password ))
193
193
{
194
194
$securePassword = ConvertTo-SecureString $Password - AsPlainText - Force
195
195
}
196
- if (! (Test-SqlServer $SqlServerName $Username $securePassword ))
196
+ if (-not (Test-SqlServer $SqlServerName $Username $securePassword ))
197
197
{
198
198
Write-Warning " Could not find SQL Server at '$SqlServerName '!"
199
199
$SqlServerName = ' localhost'
200
200
201
- if (! (Test-SqlServer $SqlServerName ))
201
+ if (-not (Test-SqlServer $SqlServerName ))
202
202
{
203
203
throw ' Could not find any SQL Server instances!'
204
204
}
@@ -224,7 +224,7 @@ function Import-BacpacToSqlServer
224
224
" /SourceFile:`" $BacpacPath `" "
225
225
)
226
226
227
- if (! [string ]::IsNullOrEmpty($Username ) -and ! [string ]::IsNullOrEmpty($Password ))
227
+ if (-not [string ]::IsNullOrEmpty($Username ) -and -not [string ]::IsNullOrEmpty($Password ))
228
228
{
229
229
$parameters += " /TargetUser:`" $Username `" "
230
230
$parameters += " /TargetPassword:`" $Password `" "
0 commit comments