﻿BEGIN TRANSACTION;
IF NOT EXISTS (
    SELECT * FROM [__EFMigrationsHistory]
    WHERE [MigrationId] = N'20260709110614_AddSiteCallsNonTerminalIndex'
)
BEGIN
    EXEC(N'CREATE INDEX [IX_SiteCalls_NonTerminal] ON [SiteCalls] ([CreatedAtUtc]) INCLUDE ([SourceSite], [SourceNode], [Status]) WHERE [TerminalAtUtc] IS NULL');
END;

IF NOT EXISTS (
    SELECT * FROM [__EFMigrationsHistory]
    WHERE [MigrationId] = N'20260709110614_AddSiteCallsNonTerminalIndex'
)
BEGIN
    INSERT INTO [__EFMigrationsHistory] ([MigrationId], [ProductVersion])
    VALUES (N'20260709110614_AddSiteCallsNonTerminalIndex', N'10.0.7');
END;

COMMIT;
GO

