using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Marco.Pms.DataAccess.Migrations
{
    /// <inheritdoc />
    public partial class Removed_TenantId_From_MPIN_And_OTP : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_MPINDetails_Tenants_TenantId",
                table: "MPINDetails");

            migrationBuilder.DropForeignKey(
                name: "FK_OTPDetails_Tenants_TenantId",
                table: "OTPDetails");

            migrationBuilder.DropIndex(
                name: "IX_OTPDetails_TenantId",
                table: "OTPDetails");

            migrationBuilder.DropIndex(
                name: "IX_MPINDetails_TenantId",
                table: "MPINDetails");

            migrationBuilder.DropColumn(
                name: "TenantId",
                table: "OTPDetails");

            migrationBuilder.DropColumn(
                name: "TenantId",
                table: "MPINDetails");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<Guid>(
                name: "TenantId",
                table: "OTPDetails",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.AddColumn<Guid>(
                name: "TenantId",
                table: "MPINDetails",
                type: "char(36)",
                nullable: false,
                defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
                collation: "ascii_general_ci");

            migrationBuilder.CreateIndex(
                name: "IX_OTPDetails_TenantId",
                table: "OTPDetails",
                column: "TenantId");

            migrationBuilder.CreateIndex(
                name: "IX_MPINDetails_TenantId",
                table: "MPINDetails",
                column: "TenantId");

            migrationBuilder.AddForeignKey(
                name: "FK_MPINDetails_Tenants_TenantId",
                table: "MPINDetails",
                column: "TenantId",
                principalTable: "Tenants",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_OTPDetails_Tenants_TenantId",
                table: "OTPDetails",
                column: "TenantId",
                principalTable: "Tenants",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
