diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Device.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Device.cs
index b2608b2..736cef3 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Device.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Device.cs
@@ -5,8 +5,6 @@ public sealed class Device
{
public Guid DeviceRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string DeviceId { get; set; }
/// Logical FK to .
@@ -21,6 +19,4 @@ public sealed class Device
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/DriverInstance.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/DriverInstance.cs
index 3453562..3927622 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/DriverInstance.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/DriverInstance.cs
@@ -5,8 +5,6 @@ public sealed class DriverInstance
{
public Guid DriverInstanceRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string DriverInstanceId { get; set; }
public required string ClusterId { get; set; }
@@ -48,6 +46,5 @@ public sealed class DriverInstance
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
- public ConfigGeneration? Generation { get; set; }
public ServerCluster? Cluster { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Equipment.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Equipment.cs
index 53c4bbc..d4cd5e6 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Equipment.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Equipment.cs
@@ -9,8 +9,6 @@ public sealed class Equipment
{
public Guid EquipmentRowId { get; set; }
- public long GenerationId { get; set; }
-
///
/// System-generated stable internal logical ID. Format: 'EQ-' + first 12 hex chars of EquipmentUuid.
/// NEVER operator-supplied, NEVER in CSV imports, NEVER editable in Admin UI (decision #125).
@@ -62,6 +60,4 @@ public sealed class Equipment
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Namespace.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Namespace.cs
index 6e194cd..c22b789 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Namespace.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Namespace.cs
@@ -10,9 +10,7 @@ public sealed class Namespace
{
public Guid NamespaceRowId { get; set; }
- public long GenerationId { get; set; }
-
- /// Stable logical ID across generations, e.g. "LINE3-OPCUA-equipment".
+ /// Stable logical ID, e.g. "LINE3-OPCUA-equipment". Globally unique in v2.
public required string NamespaceId { get; set; }
public required string ClusterId { get; set; }
@@ -29,6 +27,5 @@ public sealed class Namespace
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
- public ConfigGeneration? Generation { get; set; }
public ServerCluster? Cluster { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/NodeAcl.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/NodeAcl.cs
index cc9f6b6..a69287b 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/NodeAcl.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/NodeAcl.cs
@@ -10,8 +10,6 @@ public sealed class NodeAcl
{
public Guid NodeAclRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string NodeAclId { get; set; }
public required string ClusterId { get; set; }
@@ -30,6 +28,4 @@ public sealed class NodeAcl
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/PollGroup.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/PollGroup.cs
index 6413706..5d6c99b 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/PollGroup.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/PollGroup.cs
@@ -5,8 +5,6 @@ public sealed class PollGroup
{
public Guid PollGroupRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string PollGroupId { get; set; }
public required string DriverInstanceId { get; set; }
@@ -17,6 +15,4 @@ public sealed class PollGroup
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Script.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Script.cs
index edde823..056340e 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Script.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Script.cs
@@ -17,9 +17,8 @@ namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
public sealed class Script
{
public Guid ScriptRowId { get; set; }
- public long GenerationId { get; set; }
- /// Stable logical id. Carries across generations.
+ /// Stable logical id. Globally unique in v2.
public required string ScriptId { get; set; }
/// Operator-friendly name for log filtering + Admin UI list view.
@@ -36,6 +35,4 @@ public sealed class Script
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/ScriptedAlarm.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/ScriptedAlarm.cs
index e540a7c..cb5d171 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/ScriptedAlarm.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/ScriptedAlarm.cs
@@ -17,9 +17,8 @@ namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
public sealed class ScriptedAlarm
{
public Guid ScriptedAlarmRowId { get; set; }
- public long GenerationId { get; set; }
- /// Stable logical id — drives AlarmConditionType.ConditionName.
+ /// Stable logical id — drives AlarmConditionType.ConditionName. Globally unique in v2.
public required string ScriptedAlarmId { get; set; }
/// Logical FK to — owner of this alarm.
@@ -57,6 +56,4 @@ public sealed class ScriptedAlarm
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Tag.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Tag.cs
index 31becc8..ec2f822 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Tag.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/Tag.cs
@@ -11,8 +11,6 @@ public sealed class Tag
{
public Guid TagRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string TagId { get; set; }
public required string DriverInstanceId { get; set; }
@@ -45,6 +43,4 @@ public sealed class Tag
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsArea.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsArea.cs
index dc53073..36fad95 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsArea.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsArea.cs
@@ -5,8 +5,6 @@ public sealed class UnsArea
{
public Guid UnsAreaRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string UnsAreaId { get; set; }
public required string ClusterId { get; set; }
@@ -19,6 +17,5 @@ public sealed class UnsArea
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
- public ConfigGeneration? Generation { get; set; }
public ServerCluster? Cluster { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsLine.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsLine.cs
index e7c612c..d95e7d1 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsLine.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/UnsLine.cs
@@ -5,11 +5,9 @@ public sealed class UnsLine
{
public Guid UnsLineRowId { get; set; }
- public long GenerationId { get; set; }
-
public required string UnsLineId { get; set; }
- /// Logical FK to ; resolved within the same generation.
+ /// Logical FK to .
public required string UnsAreaId { get; set; }
/// UNS level 4 segment: matches ^[a-z0-9-]{1,32}$ OR equals literal _default.
@@ -19,6 +17,4 @@ public sealed class UnsLine
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/VirtualTag.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/VirtualTag.cs
index dbb04be..bf160cc 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/VirtualTag.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/Entities/VirtualTag.cs
@@ -21,9 +21,8 @@ namespace ZB.MOM.WW.OtOpcUa.Configuration.Entities;
public sealed class VirtualTag
{
public Guid VirtualTagRowId { get; set; }
- public long GenerationId { get; set; }
- /// Stable logical id.
+ /// Stable logical id. Globally unique in v2.
public required string VirtualTagId { get; set; }
/// Logical FK to — owner of this virtual tag.
@@ -51,6 +50,4 @@ public sealed class VirtualTag
/// Optimistic concurrency token for last-write-wins detection in the v2 live-edit model.
public byte[] RowVersion { get; set; } = Array.Empty();
-
- public ConfigGeneration? Generation { get; set; }
}
diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/OtOpcUaConfigDbContext.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/OtOpcUaConfigDbContext.cs
index cd05219..334cd8f 100644
--- a/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/OtOpcUaConfigDbContext.cs
+++ b/src/Core/ZB.MOM.WW.OtOpcUa.Configuration/OtOpcUaConfigDbContext.cs
@@ -209,23 +209,18 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.Notes).HasMaxLength(1024);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany()
- .HasForeignKey(x => x.GenerationId)
- .OnDelete(DeleteBehavior.Restrict);
e.HasOne(x => x.Cluster).WithMany(c => c.Namespaces)
.HasForeignKey(x => x.ClusterId)
.OnDelete(DeleteBehavior.Restrict);
- e.HasIndex(x => new { x.GenerationId, x.ClusterId, x.Kind }).IsUnique()
- .HasDatabaseName("UX_Namespace_Generation_Cluster_Kind");
- e.HasIndex(x => new { x.GenerationId, x.NamespaceUri }).IsUnique()
- .HasDatabaseName("UX_Namespace_Generation_NamespaceUri");
- e.HasIndex(x => new { x.GenerationId, x.NamespaceId }).IsUnique()
- .HasDatabaseName("UX_Namespace_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.NamespaceId, x.ClusterId }).IsUnique()
- .HasDatabaseName("UX_Namespace_Generation_LogicalId_Cluster");
- e.HasIndex(x => new { x.GenerationId, x.ClusterId })
- .HasDatabaseName("IX_Namespace_Generation_Cluster");
+ e.HasIndex(x => new { x.ClusterId, x.Kind }).IsUnique()
+ .HasDatabaseName("UX_Namespace_Cluster_Kind");
+ e.HasIndex(x => x.NamespaceUri).IsUnique()
+ .HasDatabaseName("UX_Namespace_NamespaceUri");
+ e.HasIndex(x => x.NamespaceId).IsUnique()
+ .HasDatabaseName("UX_Namespace_LogicalId");
+ e.HasIndex(x => x.ClusterId)
+ .HasDatabaseName("IX_Namespace_Cluster");
});
}
@@ -242,12 +237,11 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.Notes).HasMaxLength(512);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
e.HasOne(x => x.Cluster).WithMany().HasForeignKey(x => x.ClusterId).OnDelete(DeleteBehavior.Restrict);
- e.HasIndex(x => new { x.GenerationId, x.ClusterId }).HasDatabaseName("IX_UnsArea_Generation_Cluster");
- e.HasIndex(x => new { x.GenerationId, x.UnsAreaId }).IsUnique().HasDatabaseName("UX_UnsArea_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.ClusterId, x.Name }).IsUnique().HasDatabaseName("UX_UnsArea_Generation_ClusterName");
+ e.HasIndex(x => x.ClusterId).HasDatabaseName("IX_UnsArea_Cluster");
+ e.HasIndex(x => x.UnsAreaId).IsUnique().HasDatabaseName("UX_UnsArea_LogicalId");
+ e.HasIndex(x => new { x.ClusterId, x.Name }).IsUnique().HasDatabaseName("UX_UnsArea_ClusterName");
});
}
@@ -264,11 +258,9 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.Notes).HasMaxLength(512);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.UnsAreaId }).HasDatabaseName("IX_UnsLine_Generation_Area");
- e.HasIndex(x => new { x.GenerationId, x.UnsLineId }).IsUnique().HasDatabaseName("UX_UnsLine_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.UnsAreaId, x.Name }).IsUnique().HasDatabaseName("UX_UnsLine_Generation_AreaName");
+ e.HasIndex(x => x.UnsAreaId).HasDatabaseName("IX_UnsLine_Area");
+ e.HasIndex(x => x.UnsLineId).IsUnique().HasDatabaseName("UX_UnsLine_LogicalId");
+ e.HasIndex(x => new { x.UnsAreaId, x.Name }).IsUnique().HasDatabaseName("UX_UnsLine_AreaName");
});
}
@@ -294,12 +286,11 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.ResilienceConfig).HasColumnType("nvarchar(max)");
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
e.HasOne(x => x.Cluster).WithMany().HasForeignKey(x => x.ClusterId).OnDelete(DeleteBehavior.Restrict);
- e.HasIndex(x => new { x.GenerationId, x.ClusterId }).HasDatabaseName("IX_DriverInstance_Generation_Cluster");
- e.HasIndex(x => new { x.GenerationId, x.NamespaceId }).HasDatabaseName("IX_DriverInstance_Generation_Namespace");
- e.HasIndex(x => new { x.GenerationId, x.DriverInstanceId }).IsUnique().HasDatabaseName("UX_DriverInstance_Generation_LogicalId");
+ e.HasIndex(x => x.ClusterId).HasDatabaseName("IX_DriverInstance_Cluster");
+ e.HasIndex(x => x.NamespaceId).HasDatabaseName("IX_DriverInstance_Namespace");
+ e.HasIndex(x => x.DriverInstanceId).IsUnique().HasDatabaseName("UX_DriverInstance_LogicalId");
});
}
@@ -319,10 +310,8 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.DeviceConfig).HasColumnType("nvarchar(max)");
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.DriverInstanceId }).HasDatabaseName("IX_Device_Generation_Driver");
- e.HasIndex(x => new { x.GenerationId, x.DeviceId }).IsUnique().HasDatabaseName("UX_Device_Generation_LogicalId");
+ e.HasIndex(x => x.DriverInstanceId).HasDatabaseName("IX_Device_Driver");
+ e.HasIndex(x => x.DeviceId).IsUnique().HasDatabaseName("UX_Device_LogicalId");
});
}
@@ -352,16 +341,14 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.EquipmentClassRef).HasMaxLength(128);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.DriverInstanceId }).HasDatabaseName("IX_Equipment_Generation_Driver");
- e.HasIndex(x => new { x.GenerationId, x.UnsLineId }).HasDatabaseName("IX_Equipment_Generation_Line");
- e.HasIndex(x => new { x.GenerationId, x.EquipmentId }).IsUnique().HasDatabaseName("UX_Equipment_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.UnsLineId, x.Name }).IsUnique().HasDatabaseName("UX_Equipment_Generation_LinePath");
- e.HasIndex(x => new { x.GenerationId, x.EquipmentUuid }).IsUnique().HasDatabaseName("UX_Equipment_Generation_Uuid");
- e.HasIndex(x => new { x.GenerationId, x.ZTag }).HasFilter("[ZTag] IS NOT NULL").HasDatabaseName("IX_Equipment_Generation_ZTag");
- e.HasIndex(x => new { x.GenerationId, x.SAPID }).HasFilter("[SAPID] IS NOT NULL").HasDatabaseName("IX_Equipment_Generation_SAPID");
- e.HasIndex(x => new { x.GenerationId, x.MachineCode }).HasDatabaseName("IX_Equipment_Generation_MachineCode");
+ e.HasIndex(x => x.DriverInstanceId).HasDatabaseName("IX_Equipment_Driver");
+ e.HasIndex(x => x.UnsLineId).HasDatabaseName("IX_Equipment_Line");
+ e.HasIndex(x => x.EquipmentId).IsUnique().HasDatabaseName("UX_Equipment_LogicalId");
+ e.HasIndex(x => new { x.UnsLineId, x.Name }).IsUnique().HasDatabaseName("UX_Equipment_LinePath");
+ e.HasIndex(x => x.EquipmentUuid).IsUnique().HasDatabaseName("UX_Equipment_Uuid");
+ e.HasIndex(x => x.ZTag).HasFilter("[ZTag] IS NOT NULL").HasDatabaseName("IX_Equipment_ZTag");
+ e.HasIndex(x => x.SAPID).HasFilter("[SAPID] IS NOT NULL").HasDatabaseName("IX_Equipment_SAPID");
+ e.HasIndex(x => x.MachineCode).HasDatabaseName("IX_Equipment_MachineCode");
});
}
@@ -387,19 +374,17 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.TagConfig).HasColumnType("nvarchar(max)");
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.DriverInstanceId, x.DeviceId }).HasDatabaseName("IX_Tag_Generation_Driver_Device");
- e.HasIndex(x => new { x.GenerationId, x.EquipmentId })
+ e.HasIndex(x => new { x.DriverInstanceId, x.DeviceId }).HasDatabaseName("IX_Tag_Driver_Device");
+ e.HasIndex(x => x.EquipmentId)
.HasFilter("[EquipmentId] IS NOT NULL")
- .HasDatabaseName("IX_Tag_Generation_Equipment");
- e.HasIndex(x => new { x.GenerationId, x.TagId }).IsUnique().HasDatabaseName("UX_Tag_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.EquipmentId, x.Name }).IsUnique()
+ .HasDatabaseName("IX_Tag_Equipment");
+ e.HasIndex(x => x.TagId).IsUnique().HasDatabaseName("UX_Tag_LogicalId");
+ e.HasIndex(x => new { x.EquipmentId, x.Name }).IsUnique()
.HasFilter("[EquipmentId] IS NOT NULL")
- .HasDatabaseName("UX_Tag_Generation_EquipmentPath");
- e.HasIndex(x => new { x.GenerationId, x.DriverInstanceId, x.FolderPath, x.Name }).IsUnique()
+ .HasDatabaseName("UX_Tag_EquipmentPath");
+ e.HasIndex(x => new { x.DriverInstanceId, x.FolderPath, x.Name }).IsUnique()
.HasFilter("[EquipmentId] IS NULL")
- .HasDatabaseName("UX_Tag_Generation_FolderPath");
+ .HasDatabaseName("UX_Tag_FolderPath");
});
}
@@ -418,10 +403,8 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.Name).HasMaxLength(128);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.DriverInstanceId }).HasDatabaseName("IX_PollGroup_Generation_Driver");
- e.HasIndex(x => new { x.GenerationId, x.PollGroupId }).IsUnique().HasDatabaseName("UX_PollGroup_Generation_LogicalId");
+ e.HasIndex(x => x.DriverInstanceId).HasDatabaseName("IX_PollGroup_Driver");
+ e.HasIndex(x => x.PollGroupId).IsUnique().HasDatabaseName("UX_PollGroup_LogicalId");
});
}
@@ -441,16 +424,14 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.Notes).HasMaxLength(512);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.ClusterId }).HasDatabaseName("IX_NodeAcl_Generation_Cluster");
- e.HasIndex(x => new { x.GenerationId, x.LdapGroup }).HasDatabaseName("IX_NodeAcl_Generation_Group");
- e.HasIndex(x => new { x.GenerationId, x.ScopeKind, x.ScopeId })
+ e.HasIndex(x => x.ClusterId).HasDatabaseName("IX_NodeAcl_Cluster");
+ e.HasIndex(x => x.LdapGroup).HasDatabaseName("IX_NodeAcl_Group");
+ e.HasIndex(x => new { x.ScopeKind, x.ScopeId })
.HasFilter("[ScopeId] IS NOT NULL")
- .HasDatabaseName("IX_NodeAcl_Generation_Scope");
- e.HasIndex(x => new { x.GenerationId, x.NodeAclId }).IsUnique().HasDatabaseName("UX_NodeAcl_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.ClusterId, x.LdapGroup, x.ScopeKind, x.ScopeId }).IsUnique()
- .HasDatabaseName("UX_NodeAcl_Generation_GroupScope");
+ .HasDatabaseName("IX_NodeAcl_Scope");
+ e.HasIndex(x => x.NodeAclId).IsUnique().HasDatabaseName("UX_NodeAcl_LogicalId");
+ e.HasIndex(x => new { x.ClusterId, x.LdapGroup, x.ScopeKind, x.ScopeId }).IsUnique()
+ .HasDatabaseName("UX_NodeAcl_GroupScope");
});
}
@@ -666,10 +647,8 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.Language).HasMaxLength(16);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.ScriptId }).IsUnique().HasDatabaseName("UX_Script_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.SourceHash }).HasDatabaseName("IX_Script_Generation_SourceHash");
+ e.HasIndex(x => x.ScriptId).IsUnique().HasDatabaseName("UX_Script_LogicalId");
+ e.HasIndex(x => x.SourceHash).HasDatabaseName("IX_Script_SourceHash");
});
}
@@ -693,11 +672,9 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.ScriptId).HasMaxLength(64);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.VirtualTagId }).IsUnique().HasDatabaseName("UX_VirtualTag_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.EquipmentId, x.Name }).IsUnique().HasDatabaseName("UX_VirtualTag_Generation_EquipmentPath");
- e.HasIndex(x => new { x.GenerationId, x.ScriptId }).HasDatabaseName("IX_VirtualTag_Generation_Script");
+ e.HasIndex(x => x.VirtualTagId).IsUnique().HasDatabaseName("UX_VirtualTag_LogicalId");
+ e.HasIndex(x => new { x.EquipmentId, x.Name }).IsUnique().HasDatabaseName("UX_VirtualTag_EquipmentPath");
+ e.HasIndex(x => x.ScriptId).HasDatabaseName("IX_VirtualTag_Script");
});
}
@@ -721,11 +698,9 @@ public sealed class OtOpcUaConfigDbContext(DbContextOptions x.PredicateScriptId).HasMaxLength(64);
e.Property(x => x.RowVersion).IsRowVersion();
- e.HasOne(x => x.Generation).WithMany().HasForeignKey(x => x.GenerationId).OnDelete(DeleteBehavior.Restrict);
-
- e.HasIndex(x => new { x.GenerationId, x.ScriptedAlarmId }).IsUnique().HasDatabaseName("UX_ScriptedAlarm_Generation_LogicalId");
- e.HasIndex(x => new { x.GenerationId, x.EquipmentId, x.Name }).IsUnique().HasDatabaseName("UX_ScriptedAlarm_Generation_EquipmentPath");
- e.HasIndex(x => new { x.GenerationId, x.PredicateScriptId }).HasDatabaseName("IX_ScriptedAlarm_Generation_Script");
+ e.HasIndex(x => x.ScriptedAlarmId).IsUnique().HasDatabaseName("UX_ScriptedAlarm_LogicalId");
+ e.HasIndex(x => new { x.EquipmentId, x.Name }).IsUnique().HasDatabaseName("UX_ScriptedAlarm_EquipmentPath");
+ e.HasIndex(x => x.PredicateScriptId).HasDatabaseName("IX_ScriptedAlarm_Script");
});
}
diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieBuilderTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieBuilderTests.cs
index 92b0fed..b7ac028 100644
--- a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieBuilderTests.cs
+++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieBuilderTests.cs
@@ -28,7 +28,6 @@ public sealed class PermissionTrieBuilderTests
{
NodeAclRowId = Guid.NewGuid(),
NodeAclId = $"acl-{Guid.NewGuid():N}",
- GenerationId = 1,
ClusterId = clusterId,
LdapGroup = group,
ScopeKind = scope,
diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieTests.cs
index d11e116..463a3f7 100644
--- a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieTests.cs
+++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/PermissionTrieTests.cs
@@ -14,7 +14,6 @@ public sealed class PermissionTrieTests
{
NodeAclRowId = Guid.NewGuid(),
NodeAclId = $"acl-{Guid.NewGuid():N}",
- GenerationId = 1,
ClusterId = clusterId,
LdapGroup = group,
ScopeKind = scope,
diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/TriePermissionEvaluatorTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/TriePermissionEvaluatorTests.cs
index ac97e44..873bee9 100644
--- a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/TriePermissionEvaluatorTests.cs
+++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/Authorization/TriePermissionEvaluatorTests.cs
@@ -24,7 +24,6 @@ public sealed class TriePermissionEvaluatorTests
{
NodeAclRowId = Guid.NewGuid(),
NodeAclId = $"acl-{Guid.NewGuid():N}",
- GenerationId = 1,
ClusterId = "c1",
LdapGroup = group,
ScopeKind = scope,
@@ -149,7 +148,6 @@ public sealed class TriePermissionEvaluatorTests
// publishes generation 2 with the grant removed and it becomes the cache "current".
// The evaluator must still honour the session's bound generation 1, not generation 2.
var gen1Row = Row("cn=ops", NodeAclScopeKind.Cluster, null, NodePermissions.Read);
- gen1Row.GenerationId = 1;
var cache = new PermissionTrieCache();
cache.Install(PermissionTrieBuilder.Build("c1", 1, [gen1Row]));
cache.Install(PermissionTrieBuilder.Build("c1", 2, [])); // gen 2 — grant revoked, now current
@@ -169,7 +167,6 @@ public sealed class TriePermissionEvaluatorTests
// Core-002 regression: session is bound to a generation no longer in the cache.
// The evaluator must fail closed rather than silently using the current generation.
var gen5Row = Row("cn=ops", NodeAclScopeKind.Cluster, null, NodePermissions.Read);
- gen5Row.GenerationId = 5;
var cache = new PermissionTrieCache();
cache.Install(PermissionTrieBuilder.Build("c1", 5, [gen5Row]));
var evaluator = new TriePermissionEvaluator(cache, _time);
diff --git a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/OpcUa/EquipmentNodeWalkerTests.cs b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/OpcUa/EquipmentNodeWalkerTests.cs
index 8e9f089..e073bfa 100644
--- a/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/OpcUa/EquipmentNodeWalkerTests.cs
+++ b/tests/Core/ZB.MOM.WW.OtOpcUa.Core.Tests/OpcUa/EquipmentNodeWalkerTests.cs
@@ -153,7 +153,7 @@ public sealed class EquipmentNodeWalkerTests
var eq = Eq("eq-1", "line-1", "oven-3");
var vtag = new VirtualTag
{
- VirtualTagRowId = Guid.NewGuid(), GenerationId = 1,
+ VirtualTagRowId = Guid.NewGuid(),
VirtualTagId = "vt-1", EquipmentId = "eq-1", Name = "LineRate",
DataType = "Float32", ScriptId = "scr-1", Historize = true,
};
@@ -179,7 +179,7 @@ public sealed class EquipmentNodeWalkerTests
var eq = Eq("eq-1", "line-1", "oven-3");
var alarm = new ScriptedAlarm
{
- ScriptedAlarmRowId = Guid.NewGuid(), GenerationId = 1,
+ ScriptedAlarmRowId = Guid.NewGuid(),
ScriptedAlarmId = "al-1", EquipmentId = "eq-1", Name = "HighTemp",
AlarmType = "LimitAlarm", MessageTemplate = "{Temp} exceeded",
PredicateScriptId = "scr-9", Severity = 800,
@@ -205,13 +205,13 @@ public sealed class EquipmentNodeWalkerTests
var eq = Eq("eq-1", "line-1", "oven-3");
var vtag = new VirtualTag
{
- VirtualTagRowId = Guid.NewGuid(), GenerationId = 1,
+ VirtualTagRowId = Guid.NewGuid(),
VirtualTagId = "vt-1", EquipmentId = "eq-1", Name = "Disabled",
DataType = "Float32", ScriptId = "scr-1", Enabled = false,
};
var alarm = new ScriptedAlarm
{
- ScriptedAlarmRowId = Guid.NewGuid(), GenerationId = 1,
+ ScriptedAlarmRowId = Guid.NewGuid(),
ScriptedAlarmId = "al-1", EquipmentId = "eq-1", Name = "DisabledAlarm",
AlarmType = "LimitAlarm", MessageTemplate = "x",
PredicateScriptId = "scr-9", Enabled = false,
@@ -313,18 +313,17 @@ public sealed class EquipmentNodeWalkerTests
private static UnsArea Area(string id, string name) => new()
{
- UnsAreaId = id, ClusterId = "c1", Name = name, GenerationId = 1,
+ UnsAreaId = id, ClusterId = "c1", Name = name,
};
private static UnsLine Line(string id, string areaId, string name) => new()
{
- UnsLineId = id, UnsAreaId = areaId, Name = name, GenerationId = 1,
+ UnsLineId = id, UnsAreaId = areaId, Name = name,
};
private static Equipment Eq(string equipmentId, string lineId, string name) => new()
{
EquipmentRowId = Guid.NewGuid(),
- GenerationId = 1,
EquipmentId = equipmentId,
EquipmentUuid = Guid.NewGuid(),
DriverInstanceId = "drv",
@@ -337,7 +336,6 @@ public sealed class EquipmentNodeWalkerTests
string? equipmentId, string? tagConfig = null) => new()
{
TagRowId = Guid.NewGuid(),
- GenerationId = 1,
TagId = tagId,
DriverInstanceId = "drv",
EquipmentId = equipmentId,