89 lines
3.4 KiB
C#
89 lines
3.4 KiB
C#
using System;
|
|
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace RMuseum.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class RSecNewFields : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserOldEmails");
|
|
|
|
migrationBuilder.AddColumn<string>(
|
|
name: "PhoneNumber",
|
|
table: "BannedEmails",
|
|
type: "nvarchar(max)",
|
|
nullable: true);
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserOldContacts",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
ChangeDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
IsEmail = table.Column<bool>(type: "bit", nullable: false),
|
|
Value = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
NormalizedValue = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserOldContacts", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserOldContacts_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserOldContacts_UserId",
|
|
table: "UserOldContacts",
|
|
column: "UserId");
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropTable(
|
|
name: "UserOldContacts");
|
|
|
|
migrationBuilder.DropColumn(
|
|
name: "PhoneNumber",
|
|
table: "BannedEmails");
|
|
|
|
migrationBuilder.CreateTable(
|
|
name: "UserOldEmails",
|
|
columns: table => new
|
|
{
|
|
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
|
ChangeDate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
|
Email = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
|
NormalizedEmail = table.Column<string>(type: "nvarchar(max)", nullable: true)
|
|
},
|
|
constraints: table =>
|
|
{
|
|
table.PrimaryKey("PK_UserOldEmails", x => x.Id);
|
|
table.ForeignKey(
|
|
name: "FK_UserOldEmails_AspNetUsers_UserId",
|
|
column: x => x.UserId,
|
|
principalTable: "AspNetUsers",
|
|
principalColumn: "Id",
|
|
onDelete: ReferentialAction.Cascade);
|
|
});
|
|
|
|
migrationBuilder.CreateIndex(
|
|
name: "IX_UserOldEmails_UserId",
|
|
table: "UserOldEmails",
|
|
column: "UserId");
|
|
}
|
|
}
|
|
}
|