using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace SolutionErp.Infrastructure.Persistence.Migrations
{
    /// <inheritdoc />
    public partial class AddApprovalWorkflowIdToPurchaseEvaluation : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "ApprovalWorkflowId",
                table: "PurchaseEvaluations",
                type: "uniqueidentifier",
                nullable: true);

            migrationBuilder.CreateIndex(
                name: "IX_PurchaseEvaluations_ApprovalWorkflowId",
                table: "PurchaseEvaluations",
                column: "ApprovalWorkflowId");

            migrationBuilder.AddForeignKey(
                name: "FK_PurchaseEvaluations_ApprovalWorkflows_ApprovalWorkflowId",
                table: "PurchaseEvaluations",
                column: "ApprovalWorkflowId",
                principalTable: "ApprovalWorkflows",
                principalColumn: "Id",
                onDelete: ReferentialAction.Restrict);
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_PurchaseEvaluations_ApprovalWorkflows_ApprovalWorkflowId",
                table: "PurchaseEvaluations");

            migrationBuilder.DropIndex(
                name: "IX_PurchaseEvaluations_ApprovalWorkflowId",
                table: "PurchaseEvaluations");

            migrationBuilder.DropColumn(
                name: "ApprovalWorkflowId",
                table: "PurchaseEvaluations");
        }
    }
}
