feat(db): add SourceNode column to SiteCalls
This commit is contained in:
@@ -59,10 +59,14 @@ public class SiteCallEntityTypeConfiguration : IEntityTypeConfiguration<SiteCall
|
||||
builder.Property(s => s.LastError)
|
||||
.HasMaxLength(1024);
|
||||
|
||||
// SourceNode (Audit Log #23, SourceNode-stamping): mapped in a follow-on migration
|
||||
// (AddSiteCallSourceNode). Ignored here for now so the AddAuditLogSourceNode
|
||||
// migration only touches AuditLog. Removed in the AddSiteCallSourceNode commit.
|
||||
builder.Ignore(s => s.SourceNode);
|
||||
// SourceNode (Audit Log #23, SourceNode-stamping): node-local identifier of the
|
||||
// cluster member that produced the call (e.g. "node-a", "central-a"). NULL is
|
||||
// valid for rows that pre-date this feature and for reconciled rows from a
|
||||
// retired node. ASCII — varchar(64). No index — Site Call Audit KPIs are
|
||||
// per-site, not per-node, on this table.
|
||||
builder.Property(s => s.SourceNode)
|
||||
.HasColumnType("varchar(64)")
|
||||
.HasMaxLength(64);
|
||||
|
||||
// Indexes — names locked for reconciliation/migration discoverability.
|
||||
// Source_Created backs "calls from this site" (Central UI Site Calls page,
|
||||
|
||||
1654
src/ScadaLink.ConfigurationDatabase/Migrations/20260523202131_AddSiteCallSourceNode.Designer.cs
generated
Normal file
1654
src/ScadaLink.ConfigurationDatabase/Migrations/20260523202131_AddSiteCallSourceNode.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ScadaLink.ConfigurationDatabase.Migrations
|
||||
{
|
||||
/// <summary>
|
||||
/// Adds the <c>SourceNode</c> column to the central <c>SiteCalls</c> table (#22,
|
||||
/// SourceNode-stamping). <c>SourceNode</c> identifies the cluster node that produced the
|
||||
/// row (e.g. <c>node-a</c>, <c>central-a</c>) — ASCII-only, so <c>varchar(64)</c> not
|
||||
/// <c>nvarchar</c>. <c>NULL</c> is valid for rows that pre-date this feature and for
|
||||
/// reconciled rows from a retired node.
|
||||
///
|
||||
/// The change is purely additive: <c>SourceNode varchar(64) NULL</c> is added with no
|
||||
/// default, so the operation is a metadata-only <c>ALTER TABLE … ADD</c>. The
|
||||
/// <c>SiteCalls</c> table is NOT partitioned (operational state, not audit), so a plain
|
||||
/// <c>ADD</c> is fine. No index — Site Call Audit KPIs are per-site, not per-node, on
|
||||
/// this table; <c>SourceNode</c> is operational metadata, never a query predicate here.
|
||||
/// Historical rows stay <c>NULL</c>.
|
||||
/// </summary>
|
||||
public partial class AddSiteCallSourceNode : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<string>(
|
||||
name: "SourceNode",
|
||||
table: "SiteCalls",
|
||||
type: "varchar(64)",
|
||||
maxLength: 64,
|
||||
nullable: true);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "SourceNode",
|
||||
table: "SiteCalls");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -262,6 +262,10 @@ namespace ScadaLink.ConfigurationDatabase.Migrations
|
||||
b.Property<int>("RetryCount")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("SourceNode")
|
||||
.HasMaxLength(64)
|
||||
.HasColumnType("varchar(64)");
|
||||
|
||||
b.Property<string>("SourceSite")
|
||||
.IsRequired()
|
||||
.HasMaxLength(64)
|
||||
|
||||
@@ -173,7 +173,7 @@ WHERE TrackedOperationId = {idText}
|
||||
// NotificationOutboxRepository.QueryAsync applies NotificationOutboxFilter.StuckCutoff.
|
||||
FormattableString sql = $@"
|
||||
SELECT TOP ({paging.PageSize})
|
||||
TrackedOperationId, Channel, Target, SourceSite, Status, RetryCount,
|
||||
TrackedOperationId, Channel, Target, SourceSite, SourceNode, Status, RetryCount,
|
||||
LastError, HttpStatus, CreatedAtUtc, UpdatedAtUtc, TerminalAtUtc, IngestedAtUtc
|
||||
FROM dbo.SiteCalls
|
||||
WHERE ({filter.Channel} IS NULL OR Channel = {filter.Channel})
|
||||
|
||||
Reference in New Issue
Block a user