using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace ZB.MOM.WW.OtOpcUa.Configuration.Migrations
{
    /// <inheritdoc />
    public partial class AddConfigAuditLogEventIdColumns : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "CorrelationId",
                table: "ConfigAuditLog",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "EventId",
                table: "ConfigAuditLog",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "UX_ConfigAuditLog_EventId",
                table: "ConfigAuditLog",
                column: "EventId",
                unique: true,
                filter: "[EventId] IS NOT NULL");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropIndex(
                name: "UX_ConfigAuditLog_EventId",
                table: "ConfigAuditLog");

            migrationBuilder.DropColumn(
                name: "CorrelationId",
                table: "ConfigAuditLog");

            migrationBuilder.DropColumn(
                name: "EventId",
                table: "ConfigAuditLog");
        }
    }
}
