migration: AddKpiRollupBackfillState (KPI-1, WP4 task 4.10)

This commit is contained in:
Joseph Doherty
2026-12-03 10:26:08 -05:00
parent e719e9027e
commit f9af013982
4 changed files with 2416 additions and 0 deletions
@@ -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