migration: AddKpiRollupBackfillState (KPI-1, WP4 task 4.10)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
-- AddKpiRollupBackfillState (2026-12-03, code review KPI-1 / WP4 task 4.10).
|
||||
-- Creates the single-row KpiRollupBackfillState table: the KPI rollup backfill's own
|
||||
-- persisted progress marker. Small, no data migration. After it is applied the first
|
||||
-- KPI recorder start folds the whole raw-retention window once (the marker starts empty).
|
||||
SET QUOTED_IDENTIFIER ON;
|
||||
SET ANSI_NULLS ON;
|
||||
GO
|
||||
|
||||
BEGIN TRANSACTION;
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20261203152501_AddKpiRollupBackfillState'
|
||||
)
|
||||
BEGIN
|
||||
CREATE TABLE [KpiRollupBackfillState] (
|
||||
[Id] int NOT NULL,
|
||||
[BackfilledThroughUtc] datetime2 NOT NULL,
|
||||
[UpdatedAtUtc] datetime2 NOT NULL,
|
||||
CONSTRAINT [PK_KpiRollupBackfillState] PRIMARY KEY ([Id])
|
||||
);
|
||||
END;
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT * FROM [__EFMigrationsHistory]
|
||||
WHERE [MigrationId] = N'20261203152501_AddKpiRollupBackfillState'
|
||||
)
|
||||
BEGIN
|
||||
INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
|
||||
VALUES (N'20261203152501_AddKpiRollupBackfillState', N'10.0.13');
|
||||
END;
|
||||
|
||||
COMMIT;
|
||||
GO
|
||||
|
||||
|
||||
+2330
File diff suppressed because it is too large
Load Diff
+35
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class AddKpiRollupBackfillState : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "KpiRollupBackfillState",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<int>(type: "int", nullable: false),
|
||||
BackfilledThroughUtc = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
UpdatedAtUtc = table.Column<DateTime>(type: "datetime2", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_KpiRollupBackfillState", x => x.Id);
|
||||
});
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "KpiRollupBackfillState");
|
||||
}
|
||||
}
|
||||
}
|
||||
+16
@@ -816,6 +816,22 @@ namespace ZB.MOM.WW.ScadaBridge.ConfigurationDatabase.Migrations
|
||||
b.ToTable("InstanceNativeAlarmSourceOverrides");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiRollupBackfillState", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("BackfilledThroughUtc")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("UpdatedAtUtc")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("KpiRollupBackfillState", (string)null);
|
||||
});
|
||||
|
||||
modelBuilder.Entity("ZB.MOM.WW.ScadaBridge.Commons.Entities.Kpi.KpiRollupHourly", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
|
||||
Reference in New Issue
Block a user