﻿BEGIN TRANSACTION;
IF NOT EXISTS (
    SELECT * FROM [__EFMigrationsHistory]
    WHERE [MigrationId] = N'20260815004957_AlignAuditLogEventIdUniqueness'
)
BEGIN

    IF EXISTS (SELECT 1 FROM sys.indexes
               WHERE name = 'UX_AuditLog_EventId' AND object_id = OBJECT_ID('dbo.AuditLog'))
        DROP INDEX UX_AuditLog_EventId ON dbo.AuditLog;
END;

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

COMMIT;
GO

