Skip to content

Commit

Permalink
Add database migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tinohager committed Jun 17, 2024
1 parent df6214d commit 19fc865
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 1 deletion.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Nager.AuthenticationService.MssqlRepository.Migrations
{
/// <inheritdoc />
public partial class AddMfa : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "IsLocked",
table: "Users",
type: "bit",
nullable: false,
defaultValue: false);

migrationBuilder.AddColumn<bool>(
name: "MfaActive",
table: "Users",
type: "bit",
nullable: false,
defaultValue: false);

migrationBuilder.AddColumn<byte[]>(
name: "MfaSecret",
table: "Users",
type: "varbinary(32)",
maxLength: 32,
nullable: true);
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "IsLocked",
table: "Users");

migrationBuilder.DropColumn(
name: "MfaActive",
table: "Users");

migrationBuilder.DropColumn(
name: "MfaSecret",
table: "Users");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "8.0.0")
.HasAnnotation("ProductVersion", "8.0.6")
.HasAnnotation("Relational:MaxIdentifierLength", 128);

SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
Expand All @@ -37,6 +37,9 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");

b.Property<bool>("IsLocked")
.HasColumnType("bit");

b.Property<DateTime?>("LastFailedValidationTimestamp")
.HasColumnType("datetime2");

Expand All @@ -47,6 +50,13 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasMaxLength(200)
.HasColumnType("nvarchar(200)");

b.Property<bool>("MfaActive")
.HasColumnType("bit");

b.Property<byte[]>("MfaSecret")
.HasMaxLength(32)
.HasColumnType("varbinary(32)");

b.Property<byte[]>("PasswordHash")
.HasMaxLength(32)
.HasColumnType("varbinary(32)");
Expand Down

0 comments on commit 19fc865

Please sign in to comment.