feat(m9/T32a): SharedSchema entity + EF config + idempotent migration + repository

This commit is contained in:
Joseph Doherty
2026-06-18 11:26:48 -04:00
parent 48111b50fd
commit fbe4ddaf58
10 changed files with 2318 additions and 0 deletions
@@ -0,0 +1,42 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
{
/// <inheritdoc />
public partial class AddSharedSchema : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SharedSchemas",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Name = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: false),
Scope = table.Column<string>(type: "nvarchar(200)", maxLength: 200, nullable: true),
SchemaJson = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_SharedSchemas", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_SharedSchemas_Name",
table: "SharedSchemas",
column: "Name",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SharedSchemas");
}
}
}
@@ -894,6 +894,35 @@ namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
b.ToTable("SmtpConfigurations");
});
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Schemas.SharedSchema", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.Property<string>("SchemaJson")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Scope")
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique();
b.ToTable("SharedSchemas");
});
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Scripts.SharedScript", b =>
{
b.Property<int>("Id")