Files
ScadaBridge/src/ScadaLink.ConfigurationDatabase/Migrations/20260523202131_AddSiteCallSourceNode.cs
T
2026-05-23 16:34:30 -04:00

43 lines
1.7 KiB
C#

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");
}
}
}