-- Register row 52: the fleet-wide bundle-unlock throttle window. -- -- Creates the central [BundleUnlockAttempt] table that both central nodes share, so -- ScadaBridge:Transport:MaxUnlockAttemptsPerIpPerHour is a fleet cap rather than a -- per-node, per-process one. Operational history, not audit: non-partitioned, standard -- [PRIMARY] filegroup, no DB-role restriction, and rows are pruned opportunistically by -- the application once they age past twice the trailing window. -- -- Run with QUOTED_IDENTIFIER ON. Several tables in this database carry filtered indexes -- and persisted computed columns, and SQL Server refuses DDL/DML against them with error -- 1934 when the session has QUOTED_IDENTIFIER OFF -- which is exactly what `sqlcmd` gives -- you by default (pass -I, or keep this header). The SETs sit in their own batch so they -- are in force when the statements after the GO parse. SET QUOTED_IDENTIFIER ON; SET ANSI_NULLS ON; GO BEGIN TRANSACTION; IF NOT EXISTS ( SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20260815154803_AddBundleUnlockAttemptTable' ) BEGIN EXEC(N'CREATE TABLE [BundleUnlockAttempt] ( [Id] bigint NOT NULL IDENTITY, [ClientKey] varchar(64) NOT NULL, [AttemptedAtUtc] datetime2 NOT NULL, CONSTRAINT [PK_BundleUnlockAttempt] PRIMARY KEY ([Id]) )'); EXEC(N'CREATE INDEX [IX_BundleUnlockAttempt_Client_Attempted] ON [BundleUnlockAttempt] ([ClientKey], [AttemptedAtUtc])'); END; IF NOT EXISTS ( SELECT * FROM [__EFMigrationsHistory] WHERE [MigrationId] = N'20260815154803_AddBundleUnlockAttemptTable' ) BEGIN INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion]) VALUES (N'20260815154803_AddBundleUnlockAttemptTable', N'10.0.7'); END; COMMIT; GO