Add queue hardening by modifying DeploymentJobTargets, DeploymentJobSteps, and DeploymentJobs tables

- Drop existing indexes on DeploymentJobTargets and DeploymentJobSteps
- Alter Status column to nvarchar(450) in DeploymentJobTargets, DeploymentJobSteps, and DeploymentJobs
- Add new columns: Finished, OutputMetadataJson, Started to DeploymentJobTargets; ErrorMessage, Finished, OutputMetadataJson, Started to DeploymentJobSteps; CorrelationId, HeartbeatAt, Priority, RowVersion, ScheduledAt, WorkerName to DeploymentJobs
- Create new indexes for improved query performance
- Add constraints to ensure OutputMetadataJson is valid JSON
- Record migration in __EFMigrationsHistory
This commit is contained in:
Torsten Brendgen
2026-07-09 08:50:09 +02:00
parent 97238c28c9
commit 01c2a5df2e
45 changed files with 8198 additions and 75 deletions

View File

@@ -0,0 +1,42 @@
[CmdletBinding()]
param(
[string]$ApiBaseUrl = 'http://localhost:5286/api',
[string]$BgwRoot = ('F:\Kunden Auftr' + [char]0x00E4 + 'ge\BGW'),
[string]$DeploymentBatchId = '80000000-0000-0000-0000-000000000101',
[string]$MergeModulePath = 'F:\Projekte\Coding\PowerShell\Merge-DSCConfigurationData\Merge-DSCConfigurationData.psd1',
[string]$ResolveModulePath = 'F:\Projekte\Coding\PowerShell\Resolve-DSCConfigurationData\Resolve-DSCConfigurationData.psd1',
[int]$ApiTimeoutSec = 30,
[switch]$UseDefaultCredentials = $true
)
$ErrorActionPreference = 'Stop'
$testPath = Join-Path -Path $PSScriptRoot -ChildPath 'BgwMerge.Api.Tests.ps1'
if (-not (Test-Path -LiteralPath $testPath -PathType Leaf)) {
throw "Pester test file [$testPath] was not found."
}
if (-not (Get-Command Invoke-Pester -ErrorAction SilentlyContinue)) {
throw 'Pester is required. Install-Module Pester or run this on a machine where Pester is available.'
}
$parameters = @{
ApiBaseUrl = $ApiBaseUrl
BgwRoot = $BgwRoot
DeploymentBatchId = $DeploymentBatchId
MergeModulePath = $MergeModulePath
ResolveModulePath = $ResolveModulePath
ApiTimeoutSec = $ApiTimeoutSec
UseDefaultCredentials = [bool]$UseDefaultCredentials
}
$result = Invoke-Pester -Script @{ Path = $testPath; Parameters = $parameters } -PassThru
if ($result.FailedCount -gt 0) {
throw "Pester test run failed. Passed=[$($result.PassedCount)] Failed=[$($result.FailedCount)] Skipped=[$($result.SkippedCount)]."
}