Код: Выделить всё
public class User : IdentityUser
{
///
/// The history of the changed password
///
public List PasswordHistory { get; set; } = [];
}
Код: Выделить всё
public void Configure(EntityTypeBuilder builder)
{
var adminUser = new User
{
Id = AdminUserId,
UserName = "admin@xxx.com",
EmailConfirmed = true,
SecurityStamp = "",
ConcurrencyStamp = "",
LockoutEnabled = true,
FirstName = "Admin",
LastName = "",
IdpUser = false,
Enabled = true,
};
Код: Выделить всё
using System.Collections.Generic;
using Microsoft.EntityFrameworkCore.Migrations;
namespace Db.Postgres.Migrations
{
///
public partial class AddPasswordHistoryToUser : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "PasswordHistory",
table: "AspNetUsers",
type: "text[]",
nullable: false);
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "C52E290D-4971-4284-923D-D9E8EE2F04CC",
column: "PasswordHistory",
value: new List());
}
///
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PasswordHistory",
table: "AspNetUsers");
}
}
}
Код: Выделить всё
public partial class AddPasswordHistoryToUser : Migration
{
///
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn(
name: "PasswordHistory",
table: "AspNetUsers",
type: "text[]",
nullable: false,
defaultValue: new List());
}
Код: Выделить всё
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "C52E290D-4971-4284-923D-D9E8EE2F04CC",
column: "PasswordHistory",
value: new List());
Подробнее здесь: https://stackoverflow.com/questions/792 ... n-postgres
Мобильная версия