function Test-ServiceManifestHasMigrations { <# .SYNOPSIS Used by both categorization and installer package to denote that the manifest requires db access Using it in both places allows us to change/update the logic if we need to in the future. .PARAMETER ServiceManifest [object] childnode or equivalent json dotted child #> [CmdletBinding()] [OutputType([bool])] param ( [object]$ServiceManifest ) $logLead = Get-LogLeadName # this lets the categorizer pass in an empty or null node to reduce complexity of testing # Additionally, a bad value clearly means we don't need to check with the database if ($null -eq $ServiceManifest) { return $false } # These are necessary for running any migrations etc $migrationsAssemblies = @($ServiceManifest.migrations.assembly).Where({$null -ne $_}) $migrationsPackages = @($ServiceManifest.migrations.package).Where({$null -ne $_}) # We can have Assemblies or Packages, but not both. $hasMigrationAssemblies = (!(Test-IsCollectionNullOrEmpty -Collection $migrationsAssemblies)) $hasMigrationPackages = (!(Test-IsCollectionNullOrEmpty -Collection $migrationsPackages)) $hasMigrations = $hasMigrationAssemblies -or $hasMigrationPackages Write-Host "$logLead : Service has migration assemblies [$hasMigrationAssemblies]" Write-Host "$logLead : Service has migration packages [$hasMigrationPackages]" Write-Host "$logLead : Service has migrations [$hasMigrations] <-- returned value" return $hasMigrations }