Skip to content

Commit 4209a92

Browse files
committed
Fixing Get-ExternalLibrary after switching to enums
1 parent c1ab52f commit 4209a92

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

functions/Invoke-DBODeployment.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@
107107
}
108108

109109
# Initialize external libraries if needed
110+
Write-PSFMessage -Level Debug -Message "Initializing libraries for $Type"
110111
Initialize-ExternalLibrary -Type $Type
111112

112113
# Replace tokens if any
114+
Write-PSFMessage -Level Debug -Message "Replacing variable tokens"
113115
foreach ($property in [DBOpsConfig]::EnumProperties() | Where-Object { $_ -ne 'Variables' }) {
114116
$config.SetValue($property, (Resolve-VariableToken $config.$property $config.Variables))
115117
}
@@ -129,14 +131,17 @@
129131
}
130132
foreach ($buildItem in $buildCollection) {
131133
foreach ($script in $buildItem.scripts) {
134+
$scriptDeploymentPath = $script.GetDeploymentPath()
135+
Write-PSFMessage -Level Debug -Message "Adding deployment script $scriptDeploymentPath"
132136
# Replace tokens in the scripts
133137
$scriptContent = Resolve-VariableToken $script.GetContent() $runtimeVariables
134-
$scriptCollection += [DbUp.Engine.SqlScript]::new($script.GetDeploymentPath(), $scriptContent)
138+
$scriptCollection += [DbUp.Engine.SqlScript]::new($scriptDeploymentPath, $scriptContent)
135139
}
136140
}
137141
}
138142
else {
139143
foreach ($scriptItem in (Get-ChildScriptItem $ScriptPath)) {
144+
Write-PSFMessage -Level Debug -Message "Adding deployment script $($scriptItem.SourcePath)"
140145
if (!$RegisterOnly) {
141146
# Replace tokens in the scripts
142147
$scriptContent = Resolve-VariableToken (Get-Content $scriptItem.FullName -Raw) $runtimeVariables
@@ -148,6 +153,7 @@
148153
}
149154
}
150155

156+
Write-PSFMessage -Level Debug -Message "Creating DbUp objects"
151157
# Get DbUp connection object
152158
$dbUpConnection = Get-ConnectionManager -Configuration $config -Type $Type
153159

@@ -202,6 +208,7 @@
202208
# Create database if necessary for supported platforms
203209
if ($config.CreateDatabase) {
204210
if ($PSCmdlet.ShouldProcess("Ensuring the target database exists")) {
211+
Write-PSFMessage -Level Debug -Message "Creating database if not exists"
205212
switch ($Type) {
206213
SqlServer { [SqlServerExtensions]::SqlDatabase([DbUp.EnsureDatabase]::For, $connString, $dbUpLog, $config.ExecutionTimeout) }
207214
}
@@ -217,6 +224,7 @@
217224
try {
218225
foreach ($script in $scriptCollection) {
219226
if ($script.Name -notin $deployedScripts) {
227+
Write-PSFMessage -Level Debug -Message "Registering script $($script.Name)"
220228
$dbUpConnection.ExecuteCommandsWithManagedConnection( {
221229
Param (
222230
$dbCommandFactory
@@ -246,6 +254,7 @@
246254
else {
247255
# Build and Upgrade
248256
if ($PSCmdlet.ShouldProcess($package, "Deploying the package")) {
257+
Write-PSFMessage -Level Debug -Message "Performing deployment"
249258
$dbUpBuild = $dbUp.Build()
250259
$upgradeResult = $dbUpBuild.PerformUpgrade()
251260
$status.Successful = $upgradeResult.Successful

internal/functions/Get-ExternalLibrary.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ function Get-ExternalLibrary {
55
)
66
$jsonFile = Join-PSFPath -Normalize (Get-Item $PSScriptRoot).Parent.FullName "json\dbops.dependencies.json"
77
$d = Get-Content $jsonFile -Raw | ConvertFrom-Json
8-
if ($Type) { $d.$Type | Where-Object { -Not $_.PSEdition -or $_.PSEdition -eq $PSVersionTable.PSEdition } }
8+
if ($null -ne $Type) { $d.$Type | Where-Object { -Not $_.PSEdition -or $_.PSEdition -eq $PSVersionTable.PSEdition } }
99
else {
1010
$rdbms = $d | Get-Member | Where-Object MemberType -eq NoteProperty | Select-Object -ExpandProperty Name
1111
$output = @{}

0 commit comments

Comments
 (0)