feat(deploy): add PendingDeployment entity + migration
This commit is contained in:
+28
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user