using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations { /// /// Drops the DriverInstanceResilienceStatus table (Gitea #524) — the sibling of #521's /// DriverHostStatus, dead for the same reason. No code ever inserted a row: the HostedService /// sampler its entity doc described was never written, and per-cluster mesh Phase 4 made it /// unbuildable as designed, since a driver-only node has no ConfigDb connection. Every /// deployment's copy of this table is empty, so the scaffolder's data-loss warning cannot bite. /// Live breaker / in-flight counters reach the AdminUI's driver status panel as /// DriverResilienceStatusChanged over the driver-resilience-status telemetry channel. /// Down() recreates the table exactly, so the rollback is lossless too. /// public partial class DropDriverInstanceResilienceStatusTable : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.DropTable( name: "DriverInstanceResilienceStatus"); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( name: "DriverInstanceResilienceStatus", columns: table => new { DriverInstanceId = table.Column(type: "nvarchar(64)", maxLength: 64, nullable: false), HostName = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), BaselineFootprintBytes = table.Column(type: "bigint", nullable: false), ConsecutiveFailures = table.Column(type: "int", nullable: false), CurrentBulkheadDepth = table.Column(type: "int", nullable: false), CurrentFootprintBytes = table.Column(type: "bigint", nullable: false), LastCircuitBreakerOpenUtc = table.Column(type: "datetime2(3)", nullable: true), LastRecycleUtc = table.Column(type: "datetime2(3)", nullable: true), LastSampledUtc = table.Column(type: "datetime2(3)", nullable: false) }, constraints: table => { table.PrimaryKey("PK_DriverInstanceResilienceStatus", x => new { x.DriverInstanceId, x.HostName }); }); migrationBuilder.CreateIndex( name: "IX_DriverResilience_LastSampled", table: "DriverInstanceResilienceStatus", column: "LastSampledUtc"); } } }