divan/RMuseum/Migrations/20210826122309_UserBehaviourLogs.cs
2021-08-26 16:56:03 +04:30

79 lines
2.8 KiB
C#

using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace RMuseum.Migrations
{
public partial class UserBehaviourLogs : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "LockoutMessage",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ScreenName",
table: "AspNetUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.CreateTable(
name: "BannedEmails",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
NormalizedEmail = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_BannedEmails", x => x.Id);
});
migrationBuilder.CreateTable(
name: "UserBehaviourLogs",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
DateTime = table.Column<DateTime>(type: "datetime2", nullable: false),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_UserBehaviourLogs", x => x.Id);
table.ForeignKey(
name: "FK_UserBehaviourLogs_AspNetUsers_UserId",
column: x => x.UserId,
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_UserBehaviourLogs_UserId",
table: "UserBehaviourLogs",
column: "UserId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "BannedEmails");
migrationBuilder.DropTable(
name: "UserBehaviourLogs");
migrationBuilder.DropColumn(
name: "LockoutMessage",
table: "AspNetUsers");
migrationBuilder.DropColumn(
name: "ScreenName",
table: "AspNetUsers");
}
}
}