677263af57
The per-IP unlock throttle's counters were a process-local ConcurrentDictionary on each central node, so the effective fleet cap was N x MaxUnlockAttemptsPerIpPerHour per client (failing over to the other node handed the client a fresh budget) and a node restart cleared the window outright. The window now lives in the central MS SQL BundleUnlockAttempt table — the HA store both central nodes already share, so no new infrastructure, no new port, no consensus protocol: - Commons: BundleUnlockAttempt entity + IBundleUnlockAttemptRepository. - ConfigurationDatabase: entity config (one index, IX_BundleUnlockAttempt_Client_Attempted, serving both the windowed count and the prune), repository (AsNoTracking count, ExecuteDeleteAsync prune), DbSet, DI registration, migration AddBundleUnlockAttemptTable + the hand-written idempotent production script under docs/plans/sql/. - Transport: IBundleUnlockAttemptWindow seam + SqlBundleUnlockAttemptWindow (singleton; resolves the scoped repository from its own scope per call, like the central purge singletons). BundleUnlockRateLimiter keeps the policy and gains TryRegisterAttemptAsync; BundleImporter.LoadAsync calls it. Behaviour preserved from row 44: locked bundles spend no hourly budget (the lockout check still runs first), throttle denials burn no per-bundle strike and are NOT recorded so they cannot roll the window forward, unattributable clients share the stricter <unattributed> bucket, and the budget counts attempts rather than failures. Config keys and their semantics are unchanged, so the rig's 500 override stays valid. Three deliberate trades, documented in both Transport docs: - FAILS OPEN. A store error logs a Warning naming the client and cap, and permits the attempt. This is a best-effort rate cap over an already authenticated, Administrator-gated surface — the availability of legitimate imports outranks the cap, and a DB blip must not make the import wizard unusable. Falling back to the process-local window was considered and rejected: it would still block a legitimate operator's 11th import. - Approximate. Count-then-insert is not atomic across nodes, so simultaneous attempts can overshoot by the number in flight — bounded, self-correcting within the window, and not worth provider-specific raw SQL. - Pruned opportunistically on the unlock path (CAS-claimed at most every 15 min per process, bounded to 1000 rows, retaining 2x the window, best-effort try/catch) rather than by a new background service — Transport owns no central scheduler. Same shape as DeploymentService's terminal-record sweep. Tests: Transport.IntegrationTests 116 passed (+10 — two limiter instances over one store enforcing a single combined window, restart durability, denials burning no budget, sliding release, bucket isolation, store-failure fail-open, caller-cancellation not swallowed, no-shared-window fallback, prune and its negative control); ConfigurationDatabase 395 passed (+5).
2122 lines
80 KiB
C#
2122 lines
80 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.ScadaBridge.ConfigurationDatabase;
|
|
|
|
#nullable disable
|
|
|
|
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
|
|
{
|
|
[DbContext(typeof(ScadaBridgeDbContext))]
|
|
[Migration("20260815154803_AddBundleUnlockAttemptTable")]
|
|
partial class AddBundleUnlockAttemptTable
|
|
{
|
|
/// <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");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Audit.AuditLogEntry", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Action")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("AfterStateJson")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<Guid?>("BundleImportId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("EntityId")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("EntityName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("EntityType")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<DateTimeOffset>("Timestamp")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("User")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Action");
|
|
|
|
b.HasIndex("BundleImportId")
|
|
.HasDatabaseName("IX_AuditLogEntries_BundleImportId");
|
|
|
|
b.HasIndex("EntityId");
|
|
|
|
b.HasIndex("EntityType");
|
|
|
|
b.HasIndex("Timestamp");
|
|
|
|
b.HasIndex("User");
|
|
|
|
b.ToTable("AuditLogEntries");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Audit.SiteCall", b =>
|
|
{
|
|
b.Property<string>("TrackedOperationId")
|
|
.HasMaxLength(36)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(36)");
|
|
|
|
b.Property<string>("Channel")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(32)");
|
|
|
|
b.Property<DateTime>("CreatedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<int?>("HttpStatus")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTime>("IngestedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("LastError")
|
|
.HasMaxLength(1024)
|
|
.HasColumnType("nvarchar(1024)");
|
|
|
|
b.Property<int>("RetryCount")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("SourceNode")
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("SourceSite")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(32)");
|
|
|
|
b.Property<string>("Target")
|
|
.IsRequired()
|
|
.HasMaxLength(256)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(256)");
|
|
|
|
b.Property<DateTime?>("TerminalAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<DateTime>("UpdatedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.HasKey("TrackedOperationId");
|
|
|
|
b.HasIndex("CreatedAtUtc")
|
|
.HasDatabaseName("IX_SiteCalls_NonTerminal")
|
|
.HasFilter("[TerminalAtUtc] IS NULL");
|
|
|
|
SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("CreatedAtUtc"), new[] { "SourceSite", "SourceNode", "Status" });
|
|
|
|
b.HasIndex("TerminalAtUtc")
|
|
.HasDatabaseName("IX_SiteCalls_Terminal")
|
|
.HasFilter("[TerminalAtUtc] IS NOT NULL");
|
|
|
|
b.HasIndex("SourceSite", "CreatedAtUtc")
|
|
.IsDescending(false, true)
|
|
.HasDatabaseName("IX_SiteCalls_Source_Created");
|
|
|
|
b.HasIndex("Status", "UpdatedAtUtc")
|
|
.IsDescending(false, true)
|
|
.HasDatabaseName("IX_SiteCalls_Status_Updated");
|
|
|
|
b.ToTable("SiteCalls", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.DeployedConfigSnapshot", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ConfigurationJson")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<DateTimeOffset>("DeployedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("DeploymentId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("RevisionHash")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeploymentId");
|
|
|
|
b.HasIndex("InstanceId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("DeployedConfigSnapshots");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.DeploymentRecord", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<DateTimeOffset?>("CompletedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<DateTimeOffset>("DeployedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("DeployedBy")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("DeploymentId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("ErrorMessage")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("RevisionHash")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<byte[]>("RowVersion")
|
|
.IsConcurrencyToken()
|
|
.IsRequired()
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasColumnType("rowversion");
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeployedAt");
|
|
|
|
b.HasIndex("DeploymentId")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("InstanceId");
|
|
|
|
b.ToTable("DeploymentRecords");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.PendingDeployment", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ConfigurationJson")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<DateTimeOffset>("CreatedAtUtc")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("DeploymentId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<DateTimeOffset>("ExpiresAtUtc")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("RevisionHash")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Token")
|
|
.IsRequired()
|
|
.HasMaxLength(128)
|
|
.HasColumnType("nvarchar(128)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeploymentId")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("ExpiresAtUtc");
|
|
|
|
b.HasIndex("InstanceId");
|
|
|
|
b.ToTable("PendingDeployments", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.SystemArtifactDeploymentRecord", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ArtifactType")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<DateTimeOffset>("DeployedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("DeployedBy")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("PerSiteStatus")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DeployedAt");
|
|
|
|
b.ToTable("SystemArtifactDeploymentRecords");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems.DatabaseConnectionDefinition", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ConnectionString")
|
|
.IsRequired()
|
|
.HasMaxLength(8000)
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("MaxRetries")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<TimeSpan>("RetryDelay")
|
|
.HasColumnType("time");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("DatabaseConnectionDefinitions");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems.ExternalSystemDefinition", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("AuthConfiguration")
|
|
.HasMaxLength(8000)
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("AuthType")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<string>("EndpointUrl")
|
|
.IsRequired()
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<int>("MaxRetries")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<TimeSpan>("RetryDelay")
|
|
.HasColumnType("time");
|
|
|
|
b.Property<int>("TimeoutSeconds")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasDefaultValue(0);
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("ExternalSystemDefinitions");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems.ExternalSystemMethod", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("ExternalSystemDefinitionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("HttpMethod")
|
|
.IsRequired()
|
|
.HasMaxLength(10)
|
|
.HasColumnType("nvarchar(10)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("ParameterDefinitions")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("Path")
|
|
.IsRequired()
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<string>("ReturnDefinition")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ExternalSystemDefinitionId", "Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("ExternalSystemMethods");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.InboundApi.ApiMethod", 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>("ParameterDefinitions")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("ReturnDefinition")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("Script")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("TimeoutSeconds")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("ApiMethods");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Area", 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<int?>("ParentAreaId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("SiteId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ParentAreaId");
|
|
|
|
b.HasIndex("SiteId", "ParentAreaId", "Name")
|
|
.IsUnique()
|
|
.HasFilter("[ParentAreaId] IS NOT NULL");
|
|
|
|
b.ToTable("Areas");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int?>("AreaId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("SiteId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("State")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<int>("TemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("UniqueName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("AreaId");
|
|
|
|
b.HasIndex("TemplateId");
|
|
|
|
b.HasIndex("SiteId", "UniqueName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Instances");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceAlarmOverride", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("AlarmCanonicalName")
|
|
.IsRequired()
|
|
.HasMaxLength(400)
|
|
.HasColumnType("nvarchar(400)");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int?>("PriorityLevelOverride")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("TriggerConfigurationOverride")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("InstanceId", "AlarmCanonicalName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("InstanceAlarmOverrides");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceAttributeOverride", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("AttributeName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("ElementDataType")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("OverrideValue")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("InstanceId", "AttributeName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("InstanceAttributeOverrides");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceConnectionBinding", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("AttributeName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int>("DataConnectionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("DataSourceReferenceOverride")
|
|
.HasMaxLength(512)
|
|
.HasColumnType("nvarchar(512)");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("DataConnectionId");
|
|
|
|
b.HasIndex("InstanceId", "AttributeName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("InstanceConnectionBindings");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceNativeAlarmSourceOverride", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ConditionFilterOverride")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<string>("ConnectionNameOverride")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int>("InstanceId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("SourceCanonicalName")
|
|
.IsRequired()
|
|
.HasMaxLength(400)
|
|
.HasColumnType("nvarchar(400)");
|
|
|
|
b.Property<string>("SourceReferenceOverride")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("InstanceId", "SourceCanonicalName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("InstanceNativeAlarmSourceOverrides");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiRollupHourly", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<DateTime>("HourStartUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<double>("MaxValue")
|
|
.HasColumnType("float");
|
|
|
|
b.Property<string>("Metric")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<double>("MinValue")
|
|
.HasColumnType("float");
|
|
|
|
b.Property<int>("SampleCount")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Scope")
|
|
.IsRequired()
|
|
.HasMaxLength(16)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(16)");
|
|
|
|
b.Property<string>("ScopeKey")
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("Source")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<double>("Value")
|
|
.HasColumnType("float");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("HourStartUtc")
|
|
.HasDatabaseName("IX_KpiRollupHourly_Hour");
|
|
|
|
b.HasIndex("Source", "Metric", "Scope", "ScopeKey", "HourStartUtc")
|
|
.IsUnique()
|
|
.HasDatabaseName("IX_KpiRollupHourly_Series");
|
|
|
|
b.ToTable("KpiRollupHourly", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiSample", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<DateTime>("CapturedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Metric")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("Scope")
|
|
.IsRequired()
|
|
.HasMaxLength(16)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(16)");
|
|
|
|
b.Property<string>("ScopeKey")
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("Source")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<double>("Value")
|
|
.HasColumnType("float");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("CapturedAtUtc")
|
|
.HasDatabaseName("IX_KpiSample_Captured");
|
|
|
|
b.HasIndex("Source", "Metric", "Scope", "ScopeKey", "CapturedAtUtc")
|
|
.HasDatabaseName("IX_KpiSample_Series");
|
|
|
|
b.ToTable("KpiSample", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.Notification", b =>
|
|
{
|
|
b.Property<string>("NotificationId")
|
|
.HasMaxLength(64)
|
|
.HasColumnType("nvarchar(64)");
|
|
|
|
b.Property<string>("Body")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<DateTimeOffset>("CreatedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<DateTimeOffset?>("DeliveredAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<DateTimeOffset?>("LastAttemptAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("LastError")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("ListName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<DateTimeOffset?>("NextAttemptAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<Guid?>("OriginExecutionId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<Guid?>("OriginParentExecutionId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("ResolvedTargets")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("RetryCount")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<DateTimeOffset>("SiteEnqueuedAt")
|
|
.HasColumnType("datetimeoffset");
|
|
|
|
b.Property<string>("SourceInstanceId")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("SourceNode")
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("SourceScript")
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("SourceSiteId")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("Subject")
|
|
.IsRequired()
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<string>("Type")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<string>("TypeData")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.HasKey("NotificationId");
|
|
|
|
b.HasIndex("DeliveredAt")
|
|
.HasDatabaseName("IX_Notifications_Delivered")
|
|
.HasFilter("[Status] = 'Delivered'");
|
|
|
|
b.HasIndex("SourceSiteId", "CreatedAt");
|
|
|
|
b.HasIndex("Status", "NextAttemptAt");
|
|
|
|
b.ToTable("Notifications");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.NotificationList", 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>("Type")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("NotificationLists");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.NotificationRecipient", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("EmailAddress")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int>("NotificationListId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("PhoneNumber")
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("NotificationListId");
|
|
|
|
b.ToTable("NotificationRecipients");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.SmsConfiguration", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("AccountSid")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<string>("ApiBaseUrl")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("AuthToken")
|
|
.HasMaxLength(8000)
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int>("ConnectionTimeoutSeconds")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("FromNumber")
|
|
.HasMaxLength(32)
|
|
.HasColumnType("nvarchar(32)");
|
|
|
|
b.Property<int>("MaxRetries")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("MessagingServiceSid")
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.Property<TimeSpan>("RetryDelay")
|
|
.HasColumnType("time");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.ToTable("SmsConfigurations");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.SmtpConfiguration", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("AuthType")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<int>("ConnectionTimeoutSeconds")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Credentials")
|
|
.HasMaxLength(8000)
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("FromAddress")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("Host")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<int>("MaxConcurrentConnections")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("MaxRetries")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("OAuth2Authority")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("OAuth2Scope")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<int>("Port")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<TimeSpan>("RetryDelay")
|
|
.HasColumnType("time");
|
|
|
|
b.Property<string>("TlsMode")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<string>("Transport")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
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")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("ParameterDefinitions")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("ReturnDefinition")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
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")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("LdapGroupName")
|
|
.IsRequired()
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("Role")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("LdapGroupName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("LdapGroupMappings");
|
|
|
|
b.HasData(
|
|
new
|
|
{
|
|
Id = 1,
|
|
LdapGroupName = "SCADA-Admins",
|
|
Role = "Administrator"
|
|
},
|
|
new
|
|
{
|
|
Id = 2,
|
|
LdapGroupName = "SCADA-Designers",
|
|
Role = "Designer"
|
|
},
|
|
new
|
|
{
|
|
Id = 3,
|
|
LdapGroupName = "SCADA-Deploy-All",
|
|
Role = "Deployer"
|
|
},
|
|
new
|
|
{
|
|
Id = 4,
|
|
LdapGroupName = "SCADA-Deploy-SiteA",
|
|
Role = "Deployer"
|
|
},
|
|
new
|
|
{
|
|
Id = 5,
|
|
LdapGroupName = "SCADA-Viewers",
|
|
Role = "Viewer"
|
|
});
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Security.SiteScopeRule", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("LdapGroupMappingId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("SiteId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("SiteId");
|
|
|
|
b.HasIndex("LdapGroupMappingId", "SiteId")
|
|
.IsUnique();
|
|
|
|
b.ToTable("SiteScopeRules");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.DataConnection", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("BackupConfiguration")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<int>("FailoverRetryCount")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int")
|
|
.HasDefaultValue(3);
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("PrimaryConfiguration")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("Protocol")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<int>("SiteId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("SiteId", "Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("DataConnections");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.Site", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<string>("GrpcNodeAAddress")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("GrpcNodeBAddress")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("NodeAAddress")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("NodeBAddress")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("SiteIdentifier")
|
|
.IsRequired()
|
|
.HasMaxLength(100)
|
|
.HasColumnType("nvarchar(100)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique();
|
|
|
|
b.HasIndex("SiteIdentifier")
|
|
.IsUnique();
|
|
|
|
b.ToTable("Sites");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<int?>("FolderId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsDerived")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int?>("OwnerCompositionId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int?>("ParentTemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("FolderId");
|
|
|
|
b.HasIndex("Name")
|
|
.IsUnique()
|
|
.HasFilter("[IsDerived] = 0");
|
|
|
|
b.HasIndex("ParentTemplateId");
|
|
|
|
b.ToTable("Templates");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateAlarm", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<bool>("IsInherited")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("IsLocked")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("LockedInDerived")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int?>("OnTriggerScriptId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("PriorityLevel")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("TemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("TriggerConfiguration")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("TriggerType")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("TemplateId", "Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("TemplateAlarms");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateAttribute", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("DataSourceReference")
|
|
.HasMaxLength(500)
|
|
.HasColumnType("nvarchar(500)");
|
|
|
|
b.Property<string>("DataType")
|
|
.IsRequired()
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<string>("ElementDataType")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.Property<bool>("IsInherited")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("IsLocked")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("LockedInDerived")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int>("TemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("Value")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("TemplateId", "Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("TemplateAttributes");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateComposition", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<int>("ComposedTemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("InstanceName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<int>("TemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ComposedTemplateId");
|
|
|
|
b.HasIndex("TemplateId", "InstanceName")
|
|
.IsUnique();
|
|
|
|
b.ToTable("TemplateCompositions");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateFolder", 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<int?>("ParentFolderId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<int>("SortOrder")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ParentFolderId", "Name")
|
|
.IsUnique()
|
|
.HasFilter("[ParentFolderId] IS NOT NULL");
|
|
|
|
b.ToTable("TemplateFolders");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateNativeAlarmSource", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("ConditionFilter")
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<string>("ConnectionName")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("Description")
|
|
.HasMaxLength(2000)
|
|
.HasColumnType("nvarchar(2000)");
|
|
|
|
b.Property<bool>("IsInherited")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("IsLocked")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("LockedInDerived")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("SourceReference")
|
|
.IsRequired()
|
|
.HasMaxLength(1000)
|
|
.HasColumnType("nvarchar(1000)");
|
|
|
|
b.Property<int>("TemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("TemplateId", "Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("TemplateNativeAlarmSources");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateScript", b =>
|
|
{
|
|
b.Property<int>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("int");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
|
|
b.Property<string>("Code")
|
|
.IsRequired()
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<int?>("ExecutionTimeoutSeconds")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<bool>("IsInherited")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("IsLocked")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<bool>("LockedInDerived")
|
|
.HasColumnType("bit");
|
|
|
|
b.Property<TimeSpan?>("MinTimeBetweenRuns")
|
|
.HasColumnType("time");
|
|
|
|
b.Property<string>("Name")
|
|
.IsRequired()
|
|
.HasMaxLength(200)
|
|
.HasColumnType("nvarchar(200)");
|
|
|
|
b.Property<string>("ParameterDefinitions")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("ReturnDefinition")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<int>("TemplateId")
|
|
.HasColumnType("int");
|
|
|
|
b.Property<string>("TriggerConfiguration")
|
|
.HasMaxLength(4000)
|
|
.HasColumnType("nvarchar(4000)");
|
|
|
|
b.Property<string>("TriggerType")
|
|
.HasMaxLength(50)
|
|
.HasColumnType("nvarchar(50)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("TemplateId", "Name")
|
|
.IsUnique();
|
|
|
|
b.ToTable("TemplateScripts");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Transport.BundleUnlockAttempt", b =>
|
|
{
|
|
b.Property<long>("Id")
|
|
.ValueGeneratedOnAdd()
|
|
.HasColumnType("bigint");
|
|
|
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<long>("Id"));
|
|
|
|
b.Property<DateTime>("AttemptedAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("ClientKey")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.HasKey("Id");
|
|
|
|
b.HasIndex("ClientKey", "AttemptedAtUtc")
|
|
.HasDatabaseName("IX_BundleUnlockAttempt_Client_Attempted");
|
|
|
|
b.ToTable("BundleUnlockAttempt", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Entities.AuditLogRow", b =>
|
|
{
|
|
b.Property<Guid>("EventId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<DateTime>("OccurredAtUtc")
|
|
.HasColumnType("datetime2");
|
|
|
|
b.Property<string>("Action")
|
|
.IsRequired()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("Actor")
|
|
.HasMaxLength(256)
|
|
.HasColumnType("nvarchar(256)");
|
|
|
|
b.Property<string>("Channel")
|
|
.IsRequired()
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(32)")
|
|
.HasColumnName("Category");
|
|
|
|
b.Property<Guid?>("CorrelationId")
|
|
.HasColumnType("uniqueidentifier");
|
|
|
|
b.Property<string>("DetailsJson")
|
|
.HasColumnType("nvarchar(max)");
|
|
|
|
b.Property<Guid?>("ExecutionId")
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasColumnType("uniqueidentifier")
|
|
.HasComputedColumnSql("CAST(JSON_VALUE(DetailsJson,'$.executionId') AS uniqueidentifier)", true);
|
|
|
|
b.Property<DateTime?>("IngestedAtUtc")
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasColumnType("datetime2(7)")
|
|
.HasComputedColumnSql("CAST(SWITCHOFFSET(CAST(JSON_VALUE(DetailsJson,'$.ingestedAtUtc') AS datetimeoffset), 0) AS datetime2(7))", false);
|
|
|
|
b.Property<string>("Kind")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(32)")
|
|
.HasComputedColumnSql("JSON_VALUE(DetailsJson,'$.kind')", true);
|
|
|
|
b.Property<string>("Outcome")
|
|
.IsRequired()
|
|
.HasMaxLength(16)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(16)");
|
|
|
|
b.Property<Guid?>("ParentExecutionId")
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasColumnType("uniqueidentifier")
|
|
.HasComputedColumnSql("CAST(JSON_VALUE(DetailsJson,'$.parentExecutionId') AS uniqueidentifier)", true);
|
|
|
|
b.Property<string>("SourceNode")
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)");
|
|
|
|
b.Property<string>("SourceSiteId")
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasMaxLength(64)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(64)")
|
|
.HasComputedColumnSql("JSON_VALUE(DetailsJson,'$.sourceSiteId')", true);
|
|
|
|
b.Property<string>("Status")
|
|
.IsRequired()
|
|
.ValueGeneratedOnAddOrUpdate()
|
|
.HasMaxLength(32)
|
|
.IsUnicode(false)
|
|
.HasColumnType("varchar(32)")
|
|
.HasComputedColumnSql("JSON_VALUE(DetailsJson,'$.status')", true);
|
|
|
|
b.Property<string>("Target")
|
|
.HasMaxLength(256)
|
|
.HasColumnType("nvarchar(256)");
|
|
|
|
b.HasKey("EventId", "OccurredAtUtc");
|
|
|
|
b.HasIndex("CorrelationId")
|
|
.HasDatabaseName("IX_AuditLog_CorrelationId")
|
|
.HasFilter("[CorrelationId] IS NOT NULL");
|
|
|
|
b.HasIndex("ExecutionId")
|
|
.HasDatabaseName("IX_AuditLog_Execution");
|
|
|
|
b.HasIndex("OccurredAtUtc")
|
|
.IsDescending()
|
|
.HasDatabaseName("IX_AuditLog_OccurredAtUtc");
|
|
|
|
SqlServerIndexBuilderExtensions.IncludeProperties(b.HasIndex("OccurredAtUtc"), new[] { "Status" });
|
|
|
|
b.HasIndex("ParentExecutionId")
|
|
.HasDatabaseName("IX_AuditLog_ParentExecution");
|
|
|
|
b.HasIndex("SourceNode", "OccurredAtUtc")
|
|
.HasDatabaseName("IX_AuditLog_Node_Occurred");
|
|
|
|
b.HasIndex("SourceSiteId", "OccurredAtUtc")
|
|
.IsDescending(false, true)
|
|
.HasDatabaseName("IX_AuditLog_Site_Occurred");
|
|
|
|
b.HasIndex("Target", "OccurredAtUtc")
|
|
.IsDescending(false, true)
|
|
.HasDatabaseName("IX_AuditLog_Target_Occurred")
|
|
.HasFilter("[Target] IS NOT NULL");
|
|
|
|
b.HasIndex("Channel", "Status", "OccurredAtUtc")
|
|
.IsDescending(false, false, true)
|
|
.HasDatabaseName("IX_AuditLog_Channel_Status_Occurred");
|
|
|
|
b.ToTable("AuditLog", (string)null);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.DeployedConfigSnapshot", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany()
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.DeploymentRecord", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany()
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Deployment.PendingDeployment", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany()
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems.ExternalSystemMethod", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.ExternalSystems.ExternalSystemDefinition", null)
|
|
.WithMany()
|
|
.HasForeignKey("ExternalSystemDefinitionId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Area", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Area", null)
|
|
.WithMany("Children")
|
|
.HasForeignKey("ParentAreaId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.Site", null)
|
|
.WithMany()
|
|
.HasForeignKey("SiteId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Area", null)
|
|
.WithMany()
|
|
.HasForeignKey("AreaId")
|
|
.OnDelete(DeleteBehavior.SetNull);
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.Site", null)
|
|
.WithMany()
|
|
.HasForeignKey("SiteId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany()
|
|
.HasForeignKey("TemplateId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceAlarmOverride", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany("AlarmOverrides")
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceAttributeOverride", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany("AttributeOverrides")
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceConnectionBinding", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.DataConnection", null)
|
|
.WithMany()
|
|
.HasForeignKey("DataConnectionId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany("ConnectionBindings")
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.InstanceNativeAlarmSourceOverride", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", null)
|
|
.WithMany("NativeAlarmSourceOverrides")
|
|
.HasForeignKey("InstanceId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.NotificationRecipient", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.NotificationList", null)
|
|
.WithMany("Recipients")
|
|
.HasForeignKey("NotificationListId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Security.SiteScopeRule", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Security.LdapGroupMapping", null)
|
|
.WithMany()
|
|
.HasForeignKey("LdapGroupMappingId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.Site", null)
|
|
.WithMany()
|
|
.HasForeignKey("SiteId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.DataConnection", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Sites.Site", null)
|
|
.WithMany()
|
|
.HasForeignKey("SiteId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateFolder", null)
|
|
.WithMany()
|
|
.HasForeignKey("FolderId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany()
|
|
.HasForeignKey("ParentTemplateId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateAlarm", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany("Alarms")
|
|
.HasForeignKey("TemplateId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateAttribute", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany("Attributes")
|
|
.HasForeignKey("TemplateId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateComposition", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany()
|
|
.HasForeignKey("ComposedTemplateId")
|
|
.OnDelete(DeleteBehavior.Restrict)
|
|
.IsRequired();
|
|
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany("Compositions")
|
|
.HasForeignKey("TemplateId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateFolder", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateFolder", null)
|
|
.WithMany()
|
|
.HasForeignKey("ParentFolderId")
|
|
.OnDelete(DeleteBehavior.Restrict);
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateNativeAlarmSource", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany("NativeAlarmSources")
|
|
.HasForeignKey("TemplateId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.TemplateScript", b =>
|
|
{
|
|
b.HasOne("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", null)
|
|
.WithMany("Scripts")
|
|
.HasForeignKey("TemplateId")
|
|
.OnDelete(DeleteBehavior.Cascade)
|
|
.IsRequired();
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Area", b =>
|
|
{
|
|
b.Navigation("Children");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Instances.Instance", b =>
|
|
{
|
|
b.Navigation("AlarmOverrides");
|
|
|
|
b.Navigation("AttributeOverrides");
|
|
|
|
b.Navigation("ConnectionBindings");
|
|
|
|
b.Navigation("NativeAlarmSourceOverrides");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Notifications.NotificationList", b =>
|
|
{
|
|
b.Navigation("Recipients");
|
|
});
|
|
|
|
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates.Template", b =>
|
|
{
|
|
b.Navigation("Alarms");
|
|
|
|
b.Navigation("Attributes");
|
|
|
|
b.Navigation("Compositions");
|
|
|
|
b.Navigation("NativeAlarmSources");
|
|
|
|
b.Navigation("Scripts");
|
|
});
|
|
#pragma warning restore 612, 618
|
|
}
|
|
}
|
|
}
|