36 lines
1.1 KiB
Transact-SQL
36 lines
1.1 KiB
Transact-SQL
-- 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
|
|
|
|
|