Files
lmxopcua/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Migrations/20260602135350_AddConfigAuditLogOutcome.Designer.cs
T
Joseph Doherty b7f5e887ee feat(audit): OtOpcUa ConfigAuditLog.Outcome column + migration + ClusterAudit visibility fix (Task 2.2)
Persist the canonical AuditOutcome and make structured audit rows visible.

- ConfigAuditLog gains a nullable Outcome column, stored as the AuditOutcome
  enum member name (nvarchar(16), mirroring how AdminRole is persisted). The
  AuditWriterActor flush now writes Outcome = evt.Outcome.ToString(). Nullable so
  legacy rows and the bespoke stored-procedure path (no derived outcome) write
  NULL.
- Migration 20260602135350_AddConfigAuditLogOutcome: additive nullable column,
  no backfill. Up adds the column, Down drops it. Chains after
  20260602112419_CanonicalizeAdminRoles; `dotnet ef migrations
  has-pending-model-changes` is clean.
- ClusterAudit visibility fix: the page filtered solely on ClusterId, but the
  structured AuditWriterActor path stamps NodeId (ClusterId null), so those rows
  were invisible. Extracted ClusterAuditQuery.ForClusterAsync (shared by the page
  and tests) which ORs in rows whose NodeId belongs to a node in the cluster —
  membership resolved from ClusterNode (NodeId -> ClusterId). SP-path
  ClusterId-stamped rows still match.

Tests: ControlPlane 45/45 (adds Outcome persistence + Denied-outcome asserts);
new Configuration ClusterAuditQueryTests 3/3 (both-paths visible, other-cluster
excluded, page-size cap); AdminUI 121/121. Configuration Unit suite is green on a
clean run (a pre-existing timing flake in ResilientConfigReaderTests, untouched
here, occasionally fails under parallel load and passes in isolation).
2026-06-02 09:59:22 -04:00

1760 lines
67 KiB
C#

// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ZB.MOM.WW.OtOpcUa.Configuration;
#nullable disable
namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations
{
[DbContext(typeof(OtOpcUaConfigDbContext))]
[Migration("20260602135350_AddConfigAuditLogOutcome")]
partial class AddConfigAuditLogOutcome
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "10.0.7")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.DataProtectionKey", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("FriendlyName")
.HasColumnType("nvarchar(max)");
b.Property<string>("Xml")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("DataProtectionKeys", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNode", b =>
{
b.Property<string>("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ApplicationUri")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<int>("DashboardPort")
.HasColumnType("int");
b.Property<string>("DriverConfigOverridesJson")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Host")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property<DateTime?>("LastSeenAt")
.HasColumnType("datetime2(3)");
b.Property<int>("OpcUaPort")
.HasColumnType("int");
b.Property<byte>("ServiceLevelBase")
.HasColumnType("tinyint");
b.HasKey("NodeId");
b.HasIndex("ApplicationUri")
.IsUnique()
.HasDatabaseName("UX_ClusterNode_ApplicationUri");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_ClusterNode_ClusterId");
b.ToTable("ClusterNode", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNodeCredential", b =>
{
b.Property<Guid>("CredentialId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Kind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("NodeId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime?>("RotatedAt")
.HasColumnType("datetime2(3)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.HasKey("CredentialId");
b.HasIndex("Kind", "Value")
.IsUnique()
.HasDatabaseName("UX_ClusterNodeCredential_Value")
.HasFilter("[Enabled] = 1");
b.HasIndex("NodeId", "Enabled")
.HasDatabaseName("IX_ClusterNodeCredential_NodeId");
b.ToTable("ClusterNodeCredential", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ConfigAuditLog", b =>
{
b.Property<long>("AuditId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("AuditId"));
b.Property<string>("ClusterId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid?>("CorrelationId")
.HasColumnType("uniqueidentifier");
b.Property<string>("DetailsJson")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("EventId")
.HasColumnType("uniqueidentifier");
b.Property<string>("EventType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<long?>("GenerationId")
.HasColumnType("bigint");
b.Property<string>("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Outcome")
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("Principal")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<DateTime>("Timestamp")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.HasKey("AuditId");
b.HasIndex("EventId")
.IsUnique()
.HasDatabaseName("UX_ConfigAuditLog_EventId")
.HasFilter("[EventId] IS NOT NULL");
b.HasIndex("GenerationId")
.HasDatabaseName("IX_ConfigAuditLog_Generation")
.HasFilter("[GenerationId] IS NOT NULL");
b.HasIndex("ClusterId", "Timestamp")
.IsDescending(false, true)
.HasDatabaseName("IX_ConfigAuditLog_Cluster_Time");
b.ToTable("ConfigAuditLog", null, t =>
{
t.HasCheckConstraint("CK_ConfigAuditLog_DetailsJson_IsJson", "DetailsJson IS NULL OR ISJSON(DetailsJson) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ConfigEdit", b =>
{
b.Property<Guid>("EditId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<DateTime>("EditedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("EditedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<Guid>("EntityId")
.HasColumnType("uniqueidentifier");
b.Property<string>("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid?>("ExecutionId")
.HasColumnType("uniqueidentifier");
b.Property<string>("FieldsJson")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("SourceNode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("EditId");
b.HasIndex("EditedAtUtc")
.HasDatabaseName("IX_ConfigEdit_EditedAt");
b.HasIndex("ExecutionId")
.HasDatabaseName("IX_ConfigEdit_Execution")
.HasFilter("[ExecutionId] IS NOT NULL");
b.HasIndex("EntityType", "EntityId")
.HasDatabaseName("IX_ConfigEdit_Entity");
b.ToTable("ConfigEdit", null, t =>
{
t.HasCheckConstraint("CK_ConfigEdit_FieldsJson_IsJson", "ISJSON(FieldsJson) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Deployment", b =>
{
b.Property<Guid>("DeploymentId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<byte[]>("ArtifactBlob")
.IsRequired()
.HasColumnType("varbinary(max)");
b.Property<DateTime>("CreatedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("FailureReason")
.HasMaxLength(2048)
.HasColumnType("nvarchar(2048)");
b.Property<string>("RevisionHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<DateTime?>("SealedAtUtc")
.HasColumnType("datetime2(3)");
b.Property<int>("Status")
.HasColumnType("int");
b.HasKey("DeploymentId");
b.HasIndex("CreatedAtUtc")
.HasDatabaseName("IX_Deployment_CreatedAt");
b.HasIndex("Status")
.HasDatabaseName("IX_Deployment_Status");
b.ToTable("Deployment", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Device", b =>
{
b.Property<Guid>("DeviceRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("DeviceConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DeviceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DriverInstanceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("DeviceRowId");
b.HasIndex("DeviceId")
.IsUnique()
.HasDatabaseName("UX_Device_LogicalId")
.HasFilter("[DeviceId] IS NOT NULL");
b.HasIndex("DriverInstanceId")
.HasDatabaseName("IX_Device_Driver");
b.ToTable("Device", null, t =>
{
t.HasCheckConstraint("CK_Device_DeviceConfig_IsJson", "ISJSON(DeviceConfig) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DriverHostStatus", b =>
{
b.Property<string>("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DriverInstanceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("HostName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Detail")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<DateTime>("LastSeenUtc")
.HasColumnType("datetime2(3)");
b.Property<string>("State")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<DateTime>("StateChangedUtc")
.HasColumnType("datetime2(3)");
b.HasKey("NodeId", "DriverInstanceId", "HostName");
b.HasIndex("LastSeenUtc")
.HasDatabaseName("IX_DriverHostStatus_LastSeen");
b.HasIndex("NodeId")
.HasDatabaseName("IX_DriverHostStatus_Node");
b.ToTable("DriverHostStatus", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DriverInstance", b =>
{
b.Property<Guid>("DriverInstanceRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DriverConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("DriverInstanceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DriverType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("NamespaceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ResilienceConfig")
.HasColumnType("nvarchar(max)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("DriverInstanceRowId");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_DriverInstance_Cluster");
b.HasIndex("DriverInstanceId")
.IsUnique()
.HasDatabaseName("UX_DriverInstance_LogicalId")
.HasFilter("[DriverInstanceId] IS NOT NULL");
b.HasIndex("NamespaceId")
.HasDatabaseName("IX_DriverInstance_Namespace");
b.ToTable("DriverInstance", null, t =>
{
t.HasCheckConstraint("CK_DriverInstance_DriverConfig_IsJson", "ISJSON(DriverConfig) = 1");
t.HasCheckConstraint("CK_DriverInstance_ResilienceConfig_IsJson", "ResilienceConfig IS NULL OR ISJSON(ResilienceConfig) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DriverInstanceResilienceStatus", b =>
{
b.Property<string>("DriverInstanceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("HostName")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<long>("BaselineFootprintBytes")
.HasColumnType("bigint");
b.Property<int>("ConsecutiveFailures")
.HasColumnType("int");
b.Property<int>("CurrentBulkheadDepth")
.HasColumnType("int");
b.Property<long>("CurrentFootprintBytes")
.HasColumnType("bigint");
b.Property<DateTime?>("LastCircuitBreakerOpenUtc")
.HasColumnType("datetime2(3)");
b.Property<DateTime?>("LastRecycleUtc")
.HasColumnType("datetime2(3)");
b.Property<DateTime>("LastSampledUtc")
.HasColumnType("datetime2(3)");
b.HasKey("DriverInstanceId", "HostName");
b.HasIndex("LastSampledUtc")
.HasDatabaseName("IX_DriverResilience_LastSampled");
b.ToTable("DriverInstanceResilienceStatus", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Equipment", b =>
{
b.Property<Guid>("EquipmentRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("AssetLocation")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("DeviceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DeviceManualUri")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("DriverInstanceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("EquipmentClassRef")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("EquipmentId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid>("EquipmentUuid")
.HasColumnType("uniqueidentifier");
b.Property<string>("HardwareRevision")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("MachineCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Manufacturer")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ManufacturerUri")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("Model")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("SAPID")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("SerialNumber")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("SoftwareRevision")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("UnsLineId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<short?>("YearOfConstruction")
.HasColumnType("smallint");
b.Property<string>("ZTag")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("EquipmentRowId");
b.HasIndex("DriverInstanceId")
.HasDatabaseName("IX_Equipment_Driver");
b.HasIndex("EquipmentId")
.IsUnique()
.HasDatabaseName("UX_Equipment_LogicalId")
.HasFilter("[EquipmentId] IS NOT NULL");
b.HasIndex("EquipmentUuid")
.IsUnique()
.HasDatabaseName("UX_Equipment_Uuid");
b.HasIndex("MachineCode")
.HasDatabaseName("IX_Equipment_MachineCode");
b.HasIndex("SAPID")
.HasDatabaseName("IX_Equipment_SAPID")
.HasFilter("[SAPID] IS NOT NULL");
b.HasIndex("UnsLineId")
.HasDatabaseName("IX_Equipment_Line");
b.HasIndex("ZTag")
.HasDatabaseName("IX_Equipment_ZTag")
.HasFilter("[ZTag] IS NOT NULL");
b.HasIndex("UnsLineId", "Name")
.IsUnique()
.HasDatabaseName("UX_Equipment_LinePath");
b.ToTable("Equipment", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.EquipmentImportBatch", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("datetime2(3)");
b.Property<string>("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<DateTime?>("FinalisedAtUtc")
.HasColumnType("datetime2(3)");
b.Property<int>("RowsAccepted")
.HasColumnType("int");
b.Property<int>("RowsRejected")
.HasColumnType("int");
b.Property<int>("RowsStaged")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("CreatedBy", "FinalisedAtUtc")
.HasDatabaseName("IX_EquipmentImportBatch_Creator_Finalised");
b.ToTable("EquipmentImportBatch", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.EquipmentImportRow", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("AssetLocation")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<Guid>("BatchId")
.HasColumnType("uniqueidentifier");
b.Property<string>("DeviceManualUri")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("EquipmentId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EquipmentUuid")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("HardwareRevision")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("IsAccepted")
.HasColumnType("bit");
b.Property<int>("LineNumberInFile")
.HasColumnType("int");
b.Property<string>("MachineCode")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Manufacturer")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("ManufacturerUri")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("Model")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("RejectReason")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("SAPID")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("SerialNumber")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("SoftwareRevision")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("UnsAreaName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("UnsLineName")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("YearOfConstruction")
.HasMaxLength(8)
.HasColumnType("nvarchar(8)");
b.Property<string>("ZTag")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.HasKey("Id");
b.HasIndex("BatchId")
.HasDatabaseName("IX_EquipmentImportRow_Batch");
b.ToTable("EquipmentImportRow", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ExternalIdReservation", b =>
{
b.Property<Guid>("ReservationId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid>("EquipmentUuid")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("FirstPublishedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("FirstPublishedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Kind")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<DateTime>("LastPublishedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("ReleaseReason")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<DateTime?>("ReleasedAt")
.HasColumnType("datetime2(3)");
b.Property<string>("ReleasedBy")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Value")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("ReservationId");
b.HasIndex("EquipmentUuid")
.HasDatabaseName("IX_ExternalIdReservation_Equipment");
b.HasIndex("Kind", "Value")
.IsUnique()
.HasDatabaseName("UX_ExternalIdReservation_KindValue_Active")
.HasFilter("[ReleasedAt] IS NULL");
b.ToTable("ExternalIdReservation", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.LdapGroupRoleMapping", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property<string>("ClusterId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreatedAtUtc")
.HasColumnType("datetime2(3)");
b.Property<bool>("IsSystemWide")
.HasColumnType("bit");
b.Property<string>("LdapGroup")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("Role")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.HasKey("Id");
b.HasIndex("ClusterId");
b.HasIndex("LdapGroup")
.HasDatabaseName("IX_LdapGroupRoleMapping_Group");
b.HasIndex("LdapGroup", "ClusterId")
.IsUnique()
.HasDatabaseName("UX_LdapGroupRoleMapping_Group_Cluster")
.HasFilter("[ClusterId] IS NOT NULL");
b.ToTable("LdapGroupRoleMapping", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Namespace", b =>
{
b.Property<Guid>("NamespaceRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Kind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("NamespaceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("NamespaceUri")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("Notes")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("NamespaceRowId");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_Namespace_Cluster");
b.HasIndex("NamespaceId")
.IsUnique()
.HasDatabaseName("UX_Namespace_LogicalId")
.HasFilter("[NamespaceId] IS NOT NULL");
b.HasIndex("NamespaceUri")
.IsUnique()
.HasDatabaseName("UX_Namespace_NamespaceUri");
b.HasIndex("ClusterId", "Kind")
.IsUnique()
.HasDatabaseName("UX_Namespace_Cluster_Kind");
b.ToTable("Namespace", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.NodeAcl", b =>
{
b.Property<Guid>("NodeAclRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("LdapGroup")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property<string>("NodeAclId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<int>("PermissionFlags")
.HasColumnType("int");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("ScopeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("ScopeKind")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.HasKey("NodeAclRowId");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_NodeAcl_Cluster");
b.HasIndex("LdapGroup")
.HasDatabaseName("IX_NodeAcl_Group");
b.HasIndex("NodeAclId")
.IsUnique()
.HasDatabaseName("UX_NodeAcl_LogicalId")
.HasFilter("[NodeAclId] IS NOT NULL");
b.HasIndex("ScopeKind", "ScopeId")
.HasDatabaseName("IX_NodeAcl_Scope")
.HasFilter("[ScopeId] IS NOT NULL");
b.HasIndex("ClusterId", "LdapGroup", "ScopeKind", "ScopeId")
.IsUnique()
.HasDatabaseName("UX_NodeAcl_GroupScope")
.HasFilter("[ScopeId] IS NOT NULL");
b.ToTable("NodeAcl", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.NodeDeploymentState", b =>
{
b.Property<string>("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<Guid>("DeploymentId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime?>("AppliedAtUtc")
.HasColumnType("datetime2(3)");
b.Property<string>("FailureReason")
.HasMaxLength(2048)
.HasColumnType("nvarchar(2048)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<DateTime>("StartedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<int>("Status")
.HasColumnType("int");
b.HasKey("NodeId", "DeploymentId");
b.HasIndex("DeploymentId")
.HasDatabaseName("IX_NodeDeploymentState_Deployment");
b.HasIndex("Status")
.HasDatabaseName("IX_NodeDeploymentState_Status");
b.ToTable("NodeDeploymentState", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.PollGroup", b =>
{
b.Property<Guid>("PollGroupRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("DriverInstanceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("IntervalMs")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("PollGroupId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("PollGroupRowId");
b.HasIndex("DriverInstanceId")
.HasDatabaseName("IX_PollGroup_Driver");
b.HasIndex("PollGroupId")
.IsUnique()
.HasDatabaseName("UX_PollGroup_LogicalId")
.HasFilter("[PollGroupId] IS NOT NULL");
b.ToTable("PollGroup", null, t =>
{
t.HasCheckConstraint("CK_PollGroup_IntervalMs_Min", "IntervalMs >= 50");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Script", b =>
{
b.Property<Guid>("ScriptRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("Language")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("ScriptId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("SourceCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("SourceHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("ScriptRowId");
b.HasIndex("ScriptId")
.IsUnique()
.HasDatabaseName("UX_Script_LogicalId")
.HasFilter("[ScriptId] IS NOT NULL");
b.HasIndex("SourceHash")
.HasDatabaseName("IX_Script_SourceHash");
b.ToTable("Script", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ScriptedAlarm", b =>
{
b.Property<Guid>("ScriptedAlarmRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("AlarmType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("EquipmentId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("HistorizeToAveva")
.HasColumnType("bit");
b.Property<string>("MessageTemplate")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("PredicateScriptId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("Retain")
.HasColumnType("bit");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("ScriptedAlarmId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int>("Severity")
.HasColumnType("int");
b.HasKey("ScriptedAlarmRowId");
b.HasIndex("PredicateScriptId")
.HasDatabaseName("IX_ScriptedAlarm_Script");
b.HasIndex("ScriptedAlarmId")
.IsUnique()
.HasDatabaseName("UX_ScriptedAlarm_LogicalId")
.HasFilter("[ScriptedAlarmId] IS NOT NULL");
b.HasIndex("EquipmentId", "Name")
.IsUnique()
.HasDatabaseName("UX_ScriptedAlarm_EquipmentPath");
b.ToTable("ScriptedAlarm", null, t =>
{
t.HasCheckConstraint("CK_ScriptedAlarm_AlarmType", "AlarmType IN ('AlarmCondition','LimitAlarm','OffNormalAlarm','DiscreteAlarm')");
t.HasCheckConstraint("CK_ScriptedAlarm_Severity_Range", "Severity BETWEEN 1 AND 1000");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ScriptedAlarmState", b =>
{
b.Property<string>("ScriptedAlarmId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("AckedState")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("CommentsJson")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("ConfirmedState")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("EnabledState")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("LastAckComment")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<string>("LastAckUser")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<DateTime?>("LastAckUtc")
.HasColumnType("datetime2(3)");
b.Property<string>("LastConfirmComment")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<string>("LastConfirmUser")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<DateTime?>("LastConfirmUtc")
.HasColumnType("datetime2(3)");
b.Property<DateTime?>("ShelvingExpiresUtc")
.HasColumnType("datetime2(3)");
b.Property<string>("ShelvingState")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<DateTime>("UpdatedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.HasKey("ScriptedAlarmId");
b.ToTable("ScriptedAlarmState", null, t =>
{
t.HasCheckConstraint("CK_ScriptedAlarmState_CommentsJson_IsJson", "ISJSON(CommentsJson) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", b =>
{
b.Property<string>("ClusterId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<DateTime>("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property<string>("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("Enterprise")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<DateTime?>("ModifiedAt")
.HasColumnType("datetime2(3)");
b.Property<string>("ModifiedBy")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<byte>("NodeCount")
.HasColumnType("tinyint");
b.Property<string>("Notes")
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property<string>("RedundancyMode")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("Site")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.HasKey("ClusterId");
b.HasIndex("Name")
.IsUnique()
.HasDatabaseName("UX_ServerCluster_Name");
b.HasIndex("Site")
.HasDatabaseName("IX_ServerCluster_Site");
b.ToTable("ServerCluster", null, t =>
{
t.HasCheckConstraint("CK_ServerCluster_RedundancyMode_NodeCount", "((NodeCount = 1 AND RedundancyMode = 'None') OR (NodeCount = 2 AND RedundancyMode IN ('Warm', 'Hot')))");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Tag", b =>
{
b.Property<Guid>("TagRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("AccessLevel")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property<string>("DataType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("DeviceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("DriverInstanceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("EquipmentId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("FolderPath")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<string>("PollGroupId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("TagConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("TagId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("WriteIdempotent")
.HasColumnType("bit");
b.HasKey("TagRowId");
b.HasIndex("EquipmentId")
.HasDatabaseName("IX_Tag_Equipment")
.HasFilter("[EquipmentId] IS NOT NULL");
b.HasIndex("TagId")
.IsUnique()
.HasDatabaseName("UX_Tag_LogicalId")
.HasFilter("[TagId] IS NOT NULL");
b.HasIndex("DriverInstanceId", "DeviceId")
.HasDatabaseName("IX_Tag_Driver_Device");
b.HasIndex("EquipmentId", "Name")
.IsUnique()
.HasDatabaseName("UX_Tag_EquipmentPath")
.HasFilter("[EquipmentId] IS NOT NULL");
b.HasIndex("DriverInstanceId", "FolderPath", "Name")
.IsUnique()
.HasDatabaseName("UX_Tag_FolderPath")
.HasFilter("[EquipmentId] IS NULL");
b.ToTable("Tag", null, t =>
{
t.HasCheckConstraint("CK_Tag_TagConfig_IsJson", "ISJSON(TagConfig) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.UnsArea", b =>
{
b.Property<Guid>("UnsAreaRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UnsAreaId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("UnsAreaRowId");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_UnsArea_Cluster");
b.HasIndex("UnsAreaId")
.IsUnique()
.HasDatabaseName("UX_UnsArea_LogicalId")
.HasFilter("[UnsAreaId] IS NOT NULL");
b.HasIndex("ClusterId", "Name")
.IsUnique()
.HasDatabaseName("UX_UnsArea_ClusterName");
b.ToTable("UnsArea", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.UnsLine", b =>
{
b.Property<Guid>("UnsLineRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<string>("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("UnsAreaId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<string>("UnsLineId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("UnsLineRowId");
b.HasIndex("UnsAreaId")
.HasDatabaseName("IX_UnsLine_Area");
b.HasIndex("UnsLineId")
.IsUnique()
.HasDatabaseName("UX_UnsLine_LogicalId")
.HasFilter("[UnsLineId] IS NOT NULL");
b.HasIndex("UnsAreaId", "Name")
.IsUnique()
.HasDatabaseName("UX_UnsLine_AreaName");
b.ToTable("UnsLine", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.VirtualTag", b =>
{
b.Property<Guid>("VirtualTagRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property<bool>("ChangeTriggered")
.HasColumnType("bit");
b.Property<string>("DataType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property<bool>("Enabled")
.HasColumnType("bit");
b.Property<string>("EquipmentId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<bool>("Historize")
.HasColumnType("bit");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property<byte[]>("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property<string>("ScriptId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property<int?>("TimerIntervalMs")
.HasColumnType("int");
b.Property<string>("VirtualTagId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("VirtualTagRowId");
b.HasIndex("ScriptId")
.HasDatabaseName("IX_VirtualTag_Script");
b.HasIndex("VirtualTagId")
.IsUnique()
.HasDatabaseName("UX_VirtualTag_LogicalId")
.HasFilter("[VirtualTagId] IS NOT NULL");
b.HasIndex("EquipmentId", "Name")
.IsUnique()
.HasDatabaseName("UX_VirtualTag_EquipmentPath");
b.ToTable("VirtualTag", null, t =>
{
t.HasCheckConstraint("CK_VirtualTag_TimerInterval_Min", "TimerIntervalMs IS NULL OR TimerIntervalMs >= 50");
t.HasCheckConstraint("CK_VirtualTag_Trigger_AtLeastOne", "ChangeTriggered = 1 OR TimerIntervalMs IS NOT NULL");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNode", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", "Cluster")
.WithMany("Nodes")
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Cluster");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNodeCredential", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNode", "Node")
.WithMany("Credentials")
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Node");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DriverInstance", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", "Cluster")
.WithMany()
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Cluster");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.EquipmentImportRow", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.EquipmentImportBatch", "Batch")
.WithMany("Rows")
.HasForeignKey("BatchId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Batch");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.LdapGroupRoleMapping", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", "Cluster")
.WithMany()
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Cascade);
b.Navigation("Cluster");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Namespace", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", "Cluster")
.WithMany("Namespaces")
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Cluster");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.NodeDeploymentState", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Deployment", "Deployment")
.WithMany()
.HasForeignKey("DeploymentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNode", "Node")
.WithMany()
.HasForeignKey("NodeId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Deployment");
b.Navigation("Node");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.UnsArea", b =>
{
b.HasOne("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", "Cluster")
.WithMany()
.HasForeignKey("ClusterId")
.OnDelete(DeleteBehavior.Restrict)
.IsRequired();
b.Navigation("Cluster");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNode", b =>
{
b.Navigation("Credentials");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.EquipmentImportBatch", b =>
{
b.Navigation("Rows");
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ServerCluster", b =>
{
b.Navigation("Namespaces");
b.Navigation("Nodes");
});
#pragma warning restore 612, 618
}
}
}