using System; using Microsoft.EntityFrameworkCore.Migrations; #nullable disable namespace Data.SeaHavenIndustries.Migrations { /// public partial class HashPasswordResetCodes : Migration { /// protected override void Up(MigrationBuilder migrationBuilder) { // Pending codes were stored in plaintext with no expiry. They are // short-lived, so they are discarded rather than migrated; affected users // request a new code. migrationBuilder.Sql("DELETE FROM [ForgetPasswordCodes];"); migrationBuilder.AddColumn( name: "CodeHash", table: "ForgetPasswordCodes", type: "nvarchar(64)", maxLength: 64, nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "CodeSalt", table: "ForgetPasswordCodes", type: "nvarchar(32)", maxLength: 32, nullable: false, defaultValue: ""); migrationBuilder.AddColumn( name: "ExpiresAtUtc", table: "ForgetPasswordCodes", type: "datetime2", nullable: false, defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); migrationBuilder.AddColumn( name: "FailedAttempts", table: "ForgetPasswordCodes", type: "int", nullable: false, defaultValue: 0); } /// protected override void Down(MigrationBuilder migrationBuilder) { migrationBuilder.DropColumn( name: "CodeHash", table: "ForgetPasswordCodes"); migrationBuilder.DropColumn( name: "CodeSalt", table: "ForgetPasswordCodes"); migrationBuilder.DropColumn( name: "ExpiresAtUtc", table: "ForgetPasswordCodes"); migrationBuilder.DropColumn( name: "FailedAttempts", table: "ForgetPasswordCodes"); } } }