feat(db): PendingSecuredWrite entity + migration + repository (T14b)

This commit is contained in:
Joseph Doherty
2026-06-18 02:09:31 -04:00
parent a0ce8b6c44
commit c799f41d53
10 changed files with 2477 additions and 0 deletions
@@ -0,0 +1,58 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
{
/// <inheritdoc />
public partial class AddPendingSecuredWriteTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "PendingSecuredWrites",
columns: table => new
{
Id = table.Column<long>(type: "bigint", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
SiteId = table.Column<string>(type: "varchar(128)", unicode: false, maxLength: 128, nullable: false),
ConnectionName = table.Column<string>(type: "varchar(128)", unicode: false, maxLength: 128, nullable: false),
TagPath = table.Column<string>(type: "varchar(512)", unicode: false, maxLength: 512, nullable: false),
ValueJson = table.Column<string>(type: "varchar(4000)", unicode: false, maxLength: 4000, nullable: false),
ValueType = table.Column<string>(type: "varchar(128)", unicode: false, maxLength: 128, nullable: false),
Status = table.Column<string>(type: "varchar(32)", unicode: false, maxLength: 32, nullable: false),
OperatorUser = table.Column<string>(type: "varchar(256)", unicode: false, maxLength: 256, nullable: false),
OperatorComment = table.Column<string>(type: "varchar(1024)", unicode: false, maxLength: 1024, nullable: true),
SubmittedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
VerifierUser = table.Column<string>(type: "varchar(256)", unicode: false, maxLength: 256, nullable: true),
VerifierComment = table.Column<string>(type: "varchar(1024)", unicode: false, maxLength: 1024, nullable: true),
DecidedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
ExecutedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: true),
ExecutionError = table.Column<string>(type: "varchar(2048)", unicode: false, maxLength: 2048, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_PendingSecuredWrites", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_PendingSecuredWrites_Site",
table: "PendingSecuredWrites",
column: "SiteId");
migrationBuilder.CreateIndex(
name: "IX_PendingSecuredWrites_Status_Submitted",
table: "PendingSecuredWrites",
columns: new[] { "Status", "SubmittedAtUtc" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "PendingSecuredWrites");
}
}
}
@@ -927,6 +927,96 @@ namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
b.ToTable("SharedScripts");
});
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.SecuredWrites.PendingSecuredWrite", b =>
{
b.Property<long>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
b.Property<string>("ConnectionName")
.IsRequired()
.HasMaxLength(128)
.IsUnicode(false)
.HasColumnType("varchar(128)");
b.Property<DateTime?>("DecidedAtUtc")
.HasColumnType("datetime2");
b.Property<DateTime?>("ExecutedAtUtc")
.HasColumnType("datetime2");
b.Property<string>("ExecutionError")
.HasMaxLength(2048)
.IsUnicode(false)
.HasColumnType("varchar(2048)");
b.Property<string>("OperatorComment")
.HasMaxLength(1024)
.IsUnicode(false)
.HasColumnType("varchar(1024)");
b.Property<string>("OperatorUser")
.IsRequired()
.HasMaxLength(256)
.IsUnicode(false)
.HasColumnType("varchar(256)");
b.Property<string>("SiteId")
.IsRequired()
.HasMaxLength(128)
.IsUnicode(false)
.HasColumnType("varchar(128)");
b.Property<string>("Status")
.IsRequired()
.HasMaxLength(32)
.IsUnicode(false)
.HasColumnType("varchar(32)");
b.Property<DateTime>("SubmittedAtUtc")
.HasColumnType("datetime2");
b.Property<string>("TagPath")
.IsRequired()
.HasMaxLength(512)
.IsUnicode(false)
.HasColumnType("varchar(512)");
b.Property<string>("ValueJson")
.IsRequired()
.HasMaxLength(4000)
.IsUnicode(false)
.HasColumnType("varchar(4000)");
b.Property<string>("ValueType")
.IsRequired()
.HasMaxLength(128)
.IsUnicode(false)
.HasColumnType("varchar(128)");
b.Property<string>("VerifierComment")
.HasMaxLength(1024)
.IsUnicode(false)
.HasColumnType("varchar(1024)");
b.Property<string>("VerifierUser")
.HasMaxLength(256)
.IsUnicode(false)
.HasColumnType("varchar(256)");
b.HasKey("Id");
b.HasIndex("SiteId")
.HasDatabaseName("IX_PendingSecuredWrites_Site");
b.HasIndex("Status", "SubmittedAtUtc")
.HasDatabaseName("IX_PendingSecuredWrites_Status_Submitted");
b.ToTable("PendingSecuredWrites", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Security.LdapGroupMapping", b =>
{
b.Property<int>("Id")