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

@@ -1,5 +1,7 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
namespace Microsoft.SelfService.Portal.Core.API.Models
{
public class QueueJobModel : BaseModel
@@ -40,6 +42,24 @@ namespace Microsoft.SelfService.Portal.Core.API.Models
[Column(Order = 12)]
public string? RuleSnapshotJson { get; set; }
[Column(Order = 13)]
public Guid CorrelationId { get; set; } = Guid.NewGuid();
[Column(Order = 14)]
public int Priority { get; set; } = 100;
[Column(Order = 15)]
public DateTime? ScheduledAt { get; set; }
[Column(Order = 16)]
public DateTime? HeartbeatAt { get; set; }
[Column(Order = 17)]
public string? WorkerName { get; set; }
[Timestamp]
public byte[] RowVersion { get; set; } = [];
public ICollection<QueueJobTargetModel> Targets { get; set; } = new List<QueueJobTargetModel>();
public ICollection<QueueJobStepModel> Steps { get; set; } = new List<QueueJobStepModel>();
}