using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Marco.Pms.DataAccess.Migrations
{
    /// 
    public partial class Added_OTP_And_MPIN_Table : Migration
    {
        /// 
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "MPINDetails",
                columns: table => new
                {
                    Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    MPIN = table.Column(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    MPINToken = table.Column(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    TimeStamp = table.Column(type: "datetime(6)", nullable: false),
                    TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_MPINDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_MPINDetails_Tenants_TenantId",
                        column: x => x.TenantId,
                        principalTable: "Tenants",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
            migrationBuilder.CreateTable(
                name: "OTPDetails",
                columns: table => new
                {
                    Id = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    UserId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    OTP = table.Column(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ExpriesInSec = table.Column(type: "int", nullable: false),
                    TimeStamp = table.Column(type: "datetime(6)", nullable: false),
                    TenantId = table.Column(type: "char(36)", nullable: false, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_OTPDetails", x => x.Id);
                    table.ForeignKey(
                        name: "FK_OTPDetails_Tenants_TenantId",
                        column: x => x.TenantId,
                        principalTable: "Tenants",
                        principalColumn: "Id",
                        onDelete: ReferentialAction.Cascade);
                })
                .Annotation("MySql:CharSet", "utf8mb4");
            migrationBuilder.CreateIndex(
                name: "IX_MPINDetails_TenantId",
                table: "MPINDetails",
                column: "TenantId");
            migrationBuilder.CreateIndex(
                name: "IX_OTPDetails_TenantId",
                table: "OTPDetails",
                column: "TenantId");
        }
        /// 
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "MPINDetails");
            migrationBuilder.DropTable(
                name: "OTPDetails");
        }
    }
}