using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Marco.Pms.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class Added_Service_FK_In_ProjectAllocation : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "ServiceId",
                table: "ProjectAllocations",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<string>(
                name: "logoImage",
                table: "Organizations",
                type: "longtext",
                nullable: true)
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.UpdateData(
                table: "Organizations",
                keyColumn: "Id",
                keyValue: new Guid("4e3a6d31-c640-40f7-8d67-6c109fcdb9ea"),
                column: "logoImage",
                value: null);

            migrationBuilder.CreateIndex(
                name: "IX_ProjectAllocations_ServiceId",
                table: "ProjectAllocations",
                column: "ServiceId");

            migrationBuilder.AddForeignKey(
                name: "FK_ProjectAllocations_ServiceMasters_ServiceId",
                table: "ProjectAllocations",
                column: "ServiceId",
                principalTable: "ServiceMasters",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropIndex(
                name: "IX_ProjectAllocations_ServiceId",
                table: "ProjectAllocations");

            migrationBuilder.DropColumn(
                name: "ServiceId",
                table: "ProjectAllocations");

            migrationBuilder.DropColumn(
                name: "logoImage",
                table: "Organizations");
        }
    }
}
