- 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
68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Microsoft.SelfService.Portal.Core.API.Models
|
|
{
|
|
public class QueueJobModel : BaseModel
|
|
{
|
|
[Column(Order = 1)]
|
|
public string Type { get; set; }
|
|
|
|
[Column(Order = 2)]
|
|
public string Status { get; set; } = QueueJobStatus.Pending;
|
|
|
|
[Column(Order = 3)]
|
|
public string PayloadJson { get; set; }
|
|
|
|
[Column(Order = 4)]
|
|
public int Attempts { get; set; }
|
|
|
|
[Column(Order = 5)]
|
|
public int MaxAttempts { get; set; } = 3;
|
|
|
|
[Column(Order = 6)]
|
|
public DateTime? Started { get; set; }
|
|
|
|
[Column(Order = 7)]
|
|
public DateTime? Finished { get; set; }
|
|
|
|
[Column(Order = 8)]
|
|
public DateTime? LockedUntil { get; set; }
|
|
|
|
[Column(Order = 9)]
|
|
public string? LockedBy { get; set; }
|
|
|
|
[Column(Order = 10)]
|
|
public string? ErrorMessage { get; set; }
|
|
|
|
[Column(Order = 11)]
|
|
public string? MetadataJson { get; set; }
|
|
|
|
[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>();
|
|
}
|
|
}
|
|
|