feat(deploy): add PendingDeployment entity + migration

This commit is contained in:
Joseph Doherty
2026-06-26 12:09:27 -04:00
parent b58f3aeb61
commit 81cb455f19
6 changed files with 2217 additions and 0 deletions
@@ -0,0 +1,28 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment;
using ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances;
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Configurations;
public class PendingDeploymentConfiguration : IEntityTypeConfiguration<PendingDeployment>
{
/// <summary>Configures the EF Core mapping for <see cref="PendingDeployment"/>.</summary>
/// <param name="builder">The entity type builder.</param>
public void Configure(EntityTypeBuilder<PendingDeployment> builder)
{
builder.ToTable("PendingDeployments");
builder.HasKey(x => x.Id);
builder.Property(x => x.DeploymentId).IsRequired().HasMaxLength(100);
builder.HasIndex(x => x.DeploymentId).IsUnique();
builder.HasIndex(x => x.InstanceId);
builder.HasIndex(x => x.ExpiresAtUtc);
builder.Property(x => x.RevisionHash).IsRequired().HasMaxLength(100);
builder.Property(x => x.ConfigurationJson).IsRequired(); // nvarchar(max)
builder.Property(x => x.Token).IsRequired().HasMaxLength(128);
builder.HasOne<Instance>().WithMany()
.HasForeignKey(x => x.InstanceId)
.OnDelete(DeleteBehavior.Cascade);
}
}