//
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using ZB.MOM.WW.OtOpcUa.Configuration;
#nullable disable
namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations
{
[DbContext(typeof(OtOpcUaConfigDbContext))]
partial class OtOpcUaConfigDbContextModelSnapshot : ModelSnapshot
{
protected override void BuildModel(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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id"));
b.Property("FriendlyName")
.HasColumnType("nvarchar(max)");
b.Property("Xml")
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("DataProtectionKeys", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ApiKey", b =>
{
b.Property("ApiKeyRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("ApiKeyId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("CreatedUtc")
.HasColumnType("datetime2");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("ExpiresUtc")
.HasColumnType("datetime2");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("Principal")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("SecretHash")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.HasKey("ApiKeyRowId");
b.HasIndex("ApiKeyId")
.IsUnique()
.HasDatabaseName("UX_ApiKey_ApiKeyId");
b.HasIndex("Principal")
.HasDatabaseName("IX_ApiKey_Principal");
b.ToTable("ApiKey", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.ClusterNode", b =>
{
b.Property("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("AkkaPort")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasDefaultValue(4053);
b.Property("ApplicationUri")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("DashboardPort")
.HasColumnType("int");
b.Property("DriverConfigOverridesJson")
.HasColumnType("nvarchar(max)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("GrpcPort")
.HasColumnType("int");
b.Property("Host")
.IsRequired()
.HasMaxLength(255)
.HasColumnType("nvarchar(255)");
b.Property("LastSeenAt")
.HasColumnType("datetime2(3)");
b.Property("MaintenanceMode")
.HasColumnType("bit");
b.Property("OpcUaPort")
.HasColumnType("int");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("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("CredentialId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("Kind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("NodeId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RotatedAt")
.HasColumnType("datetime2(3)");
b.Property("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("AuditId")
.ValueGeneratedOnAdd()
.HasColumnType("bigint");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("AuditId"));
b.Property("ClusterId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("CorrelationId")
.HasColumnType("uniqueidentifier");
b.Property("DetailsJson")
.HasColumnType("nvarchar(max)");
b.Property("EventId")
.HasColumnType("uniqueidentifier");
b.Property("EventType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("GenerationId")
.HasColumnType("bigint");
b.Property("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Outcome")
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property("Principal")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("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("EditId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("EditedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("EditedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("EntityId")
.HasColumnType("uniqueidentifier");
b.Property("EntityType")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("ExecutionId")
.HasColumnType("uniqueidentifier");
b.Property("FieldsJson")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("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.DataConnection", b =>
{
b.Property("DataConnectionRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("AllowedOperations")
.HasColumnType("int");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Consistency")
.HasColumnType("int");
b.PrimitiveCollection("ConsumerNodeIds")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DataConnectionId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.PrimitiveCollection("EligibleTargetNodeIds")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("Enabled")
.HasColumnType("bit");
b.PrimitiveCollection("Endpoints")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("ExpectedClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("ExpectedNodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("HistoryTimeoutMilliseconds")
.HasColumnType("int");
b.Property("MaxBatchItems")
.HasColumnType("int");
b.Property("MaxMessageBytes")
.HasColumnType("int");
b.Property("MaxMonitoredItems")
.HasColumnType("int");
b.Property("MaxPageItems")
.HasColumnType("int");
b.Property("MaxPendingBytes")
.HasColumnType("bigint");
b.Property("MaxStreams")
.HasColumnType("int");
b.Property("Revision")
.HasColumnType("bigint");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("SecretReference")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("SecretScopeClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("TargetMode")
.HasColumnType("int");
b.Property("TimeoutMilliseconds")
.HasColumnType("int");
b.HasKey("DataConnectionRowId");
b.HasIndex("ClusterId");
b.HasIndex("DataConnectionId")
.IsUnique()
.HasFilter("[DataConnectionId] IS NOT NULL");
b.ToTable("DataConnection", null, t =>
{
t.HasCheckConstraint("CK_DataConnection_Limits", "[Revision] > 0 AND [TimeoutMilliseconds] > 0 AND [MaxBatchItems] > 0 AND [MaxPageItems] > 0 AND [MaxMessageBytes] > 0 AND [MaxStreams] > 0 AND [MaxMonitoredItems] > 0 AND [MaxPendingBytes] > 0 AND [HistoryTimeoutMilliseconds] > 0");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DataConnectionScopeState", b =>
{
b.Property("Id")
.HasColumnType("int");
b.Property("Fingerprint")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("ScopeVersion")
.HasColumnType("bigint");
b.HasKey("Id");
b.ToTable("DataConnectionScopeState", null, t =>
{
t.HasCheckConstraint("CK_DataConnectionScopeState_Singleton", "[Id] = 1 AND [ScopeVersion] >= 0");
});
b.HasData(
new
{
Id = 1,
ScopeVersion = 0L
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DataExport", b =>
{
b.Property("DataExportRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("AllowGalaxyServiceAck")
.HasColumnType("bit");
b.Property("AllowedOperations")
.HasColumnType("int");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("DataExportId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("MaxBatchItems")
.HasColumnType("int");
b.Property("MaxConcurrentHistoryReads")
.HasColumnType("int");
b.Property("MaxConditions")
.HasColumnType("int");
b.Property("MaxHistoryResponseBytes")
.HasColumnType("int");
b.Property("MaxHistoryValuesPerPage")
.HasColumnType("int");
b.Property("MaxMonitoredItems")
.HasColumnType("int");
b.Property("MaxPageItems")
.HasColumnType("int");
b.Property("MaxStreams")
.HasColumnType("int");
b.Property("PrincipalId")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("Realm")
.HasColumnType("int");
b.Property("Revision")
.HasColumnType("bigint");
b.Property("RootEntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RootKind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.HasKey("DataExportRowId");
b.HasIndex("ClusterId");
b.HasIndex("DataExportId")
.IsUnique()
.HasFilter("[DataExportId] IS NOT NULL");
b.ToTable("DataExport", null, t =>
{
t.HasCheckConstraint("CK_DataExport_Limits", "[Revision] > 0 AND [MaxBatchItems] > 0 AND [MaxPageItems] > 0 AND [MaxMonitoredItems] > 0 AND [MaxStreams] > 0 AND [MaxConcurrentHistoryReads] > 0 AND [MaxHistoryValuesPerPage] > 0 AND [MaxHistoryResponseBytes] > 0 AND [MaxConditions] > 0");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Deployment", b =>
{
b.Property("DeploymentId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("ArtifactBlob")
.IsRequired()
.HasColumnType("varbinary(max)");
b.Property("CreatedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("FailureReason")
.HasMaxLength(2048)
.HasColumnType("nvarchar(2048)");
b.Property("RevisionHash")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("SealedAtUtc")
.HasColumnType("datetime2(3)");
b.Property("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("DeviceRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("DeviceConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DeviceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("DriverInstanceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("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.HasIndex("DriverInstanceId", "Name")
.IsUnique()
.HasDatabaseName("UX_Device_Driver_Name");
b.ToTable("Device", null, t =>
{
t.HasCheckConstraint("CK_Device_DeviceConfig_IsJson", "ISJSON(DeviceConfig) = 1");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.DriverInstance", b =>
{
b.Property("DriverInstanceRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("DriverConfig")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DriverInstanceId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("DriverType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("RawFolderId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("ResilienceConfig")
.HasColumnType("nvarchar(max)");
b.Property("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("RawFolderId")
.HasDatabaseName("IX_DriverInstance_RawFolder");
b.HasIndex("ClusterId", "Name")
.IsUnique()
.HasDatabaseName("UX_DriverInstance_ClusterRoot_Name")
.HasFilter("[RawFolderId] IS NULL");
b.HasIndex("ClusterId", "RawFolderId", "Name")
.IsUnique()
.HasDatabaseName("UX_DriverInstance_Folder_Name")
.HasFilter("[RawFolderId] IS NOT NULL");
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.Equipment", b =>
{
b.Property("EquipmentRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("AssetLocation")
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property("DeviceManualUri")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("EquipmentClassRef")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("EquipmentId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("EquipmentUuid")
.HasColumnType("uniqueidentifier");
b.Property("HardwareRevision")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("MachineCode")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Manufacturer")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("ManufacturerUri")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("Model")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Name")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("SAPID")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("SerialNumber")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("SoftwareRevision")
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("UnsLineId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("YearOfConstruction")
.HasColumnType("smallint");
b.Property("ZTag")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.HasKey("EquipmentRowId");
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.ExternalIdReservation", b =>
{
b.Property("ReservationId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("EquipmentUuid")
.HasColumnType("uniqueidentifier");
b.Property("FirstPublishedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("FirstPublishedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("Kind")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property("LastPublishedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("ReleaseReason")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("ReleasedAt")
.HasColumnType("datetime2(3)");
b.Property("ReleasedBy")
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("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("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier");
b.Property("ClusterId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("CreatedAtUtc")
.HasColumnType("datetime2(3)");
b.Property("IsSystemWide")
.HasColumnType("bit");
b.Property("LdapGroup")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("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");
b.ToTable("LdapGroupRoleMapping", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.NodeAcl", b =>
{
b.Property("NodeAclRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("NodeAclId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Notes")
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("PermissionFlags")
.HasColumnType("int");
b.Property("Principal")
.IsRequired()
.HasMaxLength(256)
.HasColumnType("nvarchar(256)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("ScopeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("ScopeKind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.HasKey("NodeAclRowId");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_NodeAcl_Cluster");
b.HasIndex("NodeAclId")
.IsUnique()
.HasDatabaseName("UX_NodeAcl_LogicalId")
.HasFilter("[NodeAclId] IS NOT NULL");
b.HasIndex("Principal")
.HasDatabaseName("IX_NodeAcl_Principal");
b.HasIndex("ScopeKind", "ScopeId")
.HasDatabaseName("IX_NodeAcl_Scope")
.HasFilter("[ScopeId] IS NOT NULL");
b.HasIndex("ClusterId", "Principal", "ScopeKind", "ScopeId")
.IsUnique()
.HasDatabaseName("UX_NodeAcl_PrincipalScope");
b.ToTable("NodeAcl", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.NodeDeploymentState", b =>
{
b.Property("NodeId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("DeploymentId")
.HasColumnType("uniqueidentifier");
b.Property("AppliedAtUtc")
.HasColumnType("datetime2(3)");
b.Property("FailureReason")
.HasMaxLength(2048)
.HasColumnType("nvarchar(2048)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("StartedAtUtc")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("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("PollGroupRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("DriverInstanceId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("IntervalMs")
.HasColumnType("int");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("PollGroupId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("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.RawFolder", b =>
{
b.Property("RawFolderRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("ParentRawFolderId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RawFolderId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("SortOrder")
.HasColumnType("int");
b.HasKey("RawFolderRowId");
b.HasIndex("ClusterId")
.HasDatabaseName("IX_RawFolder_Cluster");
b.HasIndex("RawFolderId")
.IsUnique()
.HasDatabaseName("UX_RawFolder_LogicalId")
.HasFilter("[RawFolderId] IS NOT NULL");
b.HasIndex("ClusterId", "Name")
.IsUnique()
.HasDatabaseName("UX_RawFolder_ClusterRoot_Name")
.HasFilter("[ParentRawFolderId] IS NULL");
b.HasIndex("ClusterId", "ParentRawFolderId", "Name")
.IsUnique()
.HasDatabaseName("UX_RawFolder_Parent_Name")
.HasFilter("[ParentRawFolderId] IS NOT NULL");
b.ToTable("RawFolder", (string)null);
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.RemoteNamespaceMapping", b =>
{
b.Property("RemoteNamespaceMappingRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("AllowedOperations")
.HasColumnType("int");
b.Property("BranchName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("ClusterId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("ConditionMethodTimeoutMilliseconds")
.HasColumnType("int");
b.Property("ConditionSnapshotTimeoutMilliseconds")
.HasColumnType("int");
b.Property("ConditionStaleTimeoutMilliseconds")
.HasColumnType("int");
b.PrimitiveCollection("ConsumerNodeIds")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("DataConnectionId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("ExpectedArrayElementKind")
.HasColumnType("int");
b.Property("ExpectedValueKind")
.HasColumnType("int");
b.Property("LocalParentId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("LocalParentKind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("MaxConditions")
.HasColumnType("int");
b.Property("MaxHistoryAssemblyBytesPerRequest")
.HasColumnType("int");
b.Property("MaxProjectionDepth")
.HasColumnType("int");
b.Property("MaxProjectionNodes")
.HasColumnType("int");
b.Property("MetadataLeaseMilliseconds")
.HasColumnType("int");
b.Property("PublishingIntervalMilliseconds")
.HasColumnType("int");
b.Property("Realm")
.HasColumnType("int");
b.Property("RemoteIdentifier")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("RemoteIdentifierKind")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("RemoteNamespaceMappingId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("RemoteNamespaceUri")
.IsRequired()
.HasMaxLength(512)
.HasColumnType("nvarchar(512)");
b.Property("RemoteRealm")
.HasColumnType("int");
b.Property("RemoteRootEntityId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Revision")
.HasColumnType("bigint");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("SamplingIntervalMilliseconds")
.HasColumnType("int");
b.Property("StaleTimeoutMilliseconds")
.HasColumnType("int");
b.Property("WriteThrough")
.HasColumnType("bit");
b.HasKey("RemoteNamespaceMappingRowId");
b.HasIndex("RemoteNamespaceMappingId")
.IsUnique()
.HasFilter("[RemoteNamespaceMappingId] IS NOT NULL");
b.HasIndex("ClusterId", "Realm", "LocalParentKind", "LocalParentId", "BranchName")
.IsUnique();
b.ToTable("RemoteNamespaceMapping", null, t =>
{
t.HasCheckConstraint("CK_RemoteNamespaceMapping_Limits", "[Revision] > 0 AND [MaxProjectionNodes] > 0 AND [MaxProjectionDepth] > 0 AND [MetadataLeaseMilliseconds] > 0 AND [StaleTimeoutMilliseconds] > 0 AND [SamplingIntervalMilliseconds] > 0 AND [PublishingIntervalMilliseconds] > 0 AND [MaxHistoryAssemblyBytesPerRequest] > 0 AND [MaxConditions] > 0 AND [ConditionStaleTimeoutMilliseconds] > 0 AND [ConditionMethodTimeoutMilliseconds] > 0 AND [ConditionSnapshotTimeoutMilliseconds] > 0");
});
});
modelBuilder.Entity("ZB.MOM.WW.OtOpcUa.Configuration.Entities.Script", b =>
{
b.Property("ScriptRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("Language")
.IsRequired()
.HasMaxLength(16)
.HasColumnType("nvarchar(16)");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("ScriptId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("SourceCode")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property("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("ScriptedAlarmRowId")
.ValueGeneratedOnAdd()
.HasColumnType("uniqueidentifier")
.HasDefaultValueSql("NEWSEQUENTIALID()");
b.Property("AlarmType")
.IsRequired()
.HasMaxLength(32)
.HasColumnType("nvarchar(32)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property("EquipmentId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("HistorizeToAveva")
.HasColumnType("bit");
b.Property("MessageTemplate")
.IsRequired()
.HasMaxLength(1024)
.HasColumnType("nvarchar(1024)");
b.Property("Name")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("PredicateScriptId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("Retain")
.HasColumnType("bit");
b.Property("RowVersion")
.IsConcurrencyToken()
.IsRequired()
.ValueGeneratedOnAddOrUpdate()
.HasColumnType("rowversion");
b.Property("ScriptedAlarmId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("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.ServerCluster", b =>
{
b.Property("ClusterId")
.HasMaxLength(64)
.HasColumnType("nvarchar(64)");
b.Property("CreatedAt")
.ValueGeneratedOnAdd()
.HasColumnType("datetime2(3)")
.HasDefaultValueSql("SYSUTCDATETIME()");
b.Property("CreatedBy")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("nvarchar(128)");
b.Property("Enabled")
.HasColumnType("bit");
b.Property