|
107 | 107 | }
|
108 | 108 |
|
109 | 109 | # Initialize external libraries if needed
|
| 110 | + Write-PSFMessage -Level Debug -Message "Initializing libraries for $Type" |
110 | 111 | Initialize-ExternalLibrary -Type $Type
|
111 | 112 |
|
112 | 113 | # Replace tokens if any
|
| 114 | + Write-PSFMessage -Level Debug -Message "Replacing variable tokens" |
113 | 115 | foreach ($property in [DBOpsConfig]::EnumProperties() | Where-Object { $_ -ne 'Variables' }) {
|
114 | 116 | $config.SetValue($property, (Resolve-VariableToken $config.$property $config.Variables))
|
115 | 117 | }
|
|
129 | 131 | }
|
130 | 132 | foreach ($buildItem in $buildCollection) {
|
131 | 133 | foreach ($script in $buildItem.scripts) {
|
| 134 | + $scriptDeploymentPath = $script.GetDeploymentPath() |
| 135 | + Write-PSFMessage -Level Debug -Message "Adding deployment script $scriptDeploymentPath" |
132 | 136 | # Replace tokens in the scripts
|
133 | 137 | $scriptContent = Resolve-VariableToken $script.GetContent() $runtimeVariables
|
134 |
| - $scriptCollection += [DbUp.Engine.SqlScript]::new($script.GetDeploymentPath(), $scriptContent) |
| 138 | + $scriptCollection += [DbUp.Engine.SqlScript]::new($scriptDeploymentPath, $scriptContent) |
135 | 139 | }
|
136 | 140 | }
|
137 | 141 | }
|
138 | 142 | else {
|
139 | 143 | foreach ($scriptItem in (Get-ChildScriptItem $ScriptPath)) {
|
| 144 | + Write-PSFMessage -Level Debug -Message "Adding deployment script $($scriptItem.SourcePath)" |
140 | 145 | if (!$RegisterOnly) {
|
141 | 146 | # Replace tokens in the scripts
|
142 | 147 | $scriptContent = Resolve-VariableToken (Get-Content $scriptItem.FullName -Raw) $runtimeVariables
|
|
148 | 153 | }
|
149 | 154 | }
|
150 | 155 |
|
| 156 | + Write-PSFMessage -Level Debug -Message "Creating DbUp objects" |
151 | 157 | # Get DbUp connection object
|
152 | 158 | $dbUpConnection = Get-ConnectionManager -Configuration $config -Type $Type
|
153 | 159 |
|
|
202 | 208 | # Create database if necessary for supported platforms
|
203 | 209 | if ($config.CreateDatabase) {
|
204 | 210 | if ($PSCmdlet.ShouldProcess("Ensuring the target database exists")) {
|
| 211 | + Write-PSFMessage -Level Debug -Message "Creating database if not exists" |
205 | 212 | switch ($Type) {
|
206 | 213 | SqlServer { [SqlServerExtensions]::SqlDatabase([DbUp.EnsureDatabase]::For, $connString, $dbUpLog, $config.ExecutionTimeout) }
|
207 | 214 | }
|
|
217 | 224 | try {
|
218 | 225 | foreach ($script in $scriptCollection) {
|
219 | 226 | if ($script.Name -notin $deployedScripts) {
|
| 227 | + Write-PSFMessage -Level Debug -Message "Registering script $($script.Name)" |
220 | 228 | $dbUpConnection.ExecuteCommandsWithManagedConnection( {
|
221 | 229 | Param (
|
222 | 230 | $dbCommandFactory
|
|
246 | 254 | else {
|
247 | 255 | # Build and Upgrade
|
248 | 256 | if ($PSCmdlet.ShouldProcess($package, "Deploying the package")) {
|
| 257 | + Write-PSFMessage -Level Debug -Message "Performing deployment" |
249 | 258 | $dbUpBuild = $dbUp.Build()
|
250 | 259 | $upgradeResult = $dbUpBuild.PerformUpgrade()
|
251 | 260 | $status.Successful = $upgradeResult.Successful
|
|
0 commit comments