using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Marco.Pms.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class Added_UpdatedBy_In_Contacts_And_ContactNotes_Table : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTime>(
                name: "UpdatedAt",
                table: "Contacts",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "UpdatedById",
                table: "Contacts",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<DateTime>(
                name: "UpdatedAt",
                table: "ContactNotes",
                type: "datetime(6)",
                nullable: true);

            migrationBuilder.AddColumn<Guid>(
                name: "UpdatedById",
                table: "ContactNotes",
                type: "char(36)",
                nullable: true,
                collation: "ascii_general_ci");

            migrationBuilder.CreateIndex(
                name: "IX_Contacts_UpdatedById",
                table: "Contacts",
                column: "UpdatedById");

            migrationBuilder.CreateIndex(
                name: "IX_ContactNotes_UpdatedById",
                table: "ContactNotes",
                column: "UpdatedById");

            migrationBuilder.AddForeignKey(
                name: "FK_ContactNotes_Employees_UpdatedById",
                table: "ContactNotes",
                column: "UpdatedById",
                principalTable: "Employees",
                principalColumn: "Id");

            migrationBuilder.AddForeignKey(
                name: "FK_Contacts_Employees_UpdatedById",
                table: "Contacts",
                column: "UpdatedById",
                principalTable: "Employees",
                principalColumn: "Id");
        }

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

            migrationBuilder.DropForeignKey(
                name: "FK_Contacts_Employees_UpdatedById",
                table: "Contacts");

            migrationBuilder.DropIndex(
                name: "IX_Contacts_UpdatedById",
                table: "Contacts");

            migrationBuilder.DropIndex(
                name: "IX_ContactNotes_UpdatedById",
                table: "ContactNotes");

            migrationBuilder.DropColumn(
                name: "UpdatedAt",
                table: "Contacts");

            migrationBuilder.DropColumn(
                name: "UpdatedById",
                table: "Contacts");

            migrationBuilder.DropColumn(
                name: "UpdatedAt",
                table: "ContactNotes");

            migrationBuilder.DropColumn(
                name: "UpdatedById",
                table: "ContactNotes");
        }
    }
}
