Skip to content

Commit

Permalink
better migration for (Thin)Hashes type working with postgresql provider
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaosEngine committed Jan 4, 2025
1 parent 97e9df2 commit 52ac875
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 15 deletions.

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

33 changes: 19 additions & 14 deletions DotnetPlayground.Web/Migrations/BloggingContextModelSnapshot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.Property<string>("Json")
.HasColumnType(BloggingContext.JsonColumnTypeFromProvider(ContextSnapshotHelper.DBKind));

b.HasKey("Id", "Environment");

b.ToTable("GoogleProtectionKeys");
Expand Down Expand Up @@ -174,19 +174,24 @@ protected override void BuildModel(ModelBuilder modelBuilder)

modelBuilder.Entity("DotnetPlayground.Models.ThinHashes", b =>
{
if (new string[]{ "npgsql.entityframeworkcore.postgresql", "postgresql" }.Contains(ContextSnapshotHelper.DBKind.ToLowerInvariant()))
{
b.Property<string>("Key").IsRequired().HasColumnType("varchar(20)");
b.Property<string>("HashMD5").IsRequired().HasColumnType("character(32)").HasColumnName("hashMD5");
b.Property<string>("HashSHA256").IsRequired().HasColumnType("character(64)").HasColumnName("hashSHA256");
}
else
{
b.Property<string>("Key").IsRequired().HasColumnType("varchar(20)");
b.Property<string>("HashMD5").IsRequired().HasColumnType("char(32)").HasColumnName("hashMD5");
b.Property<string>("HashSHA256").IsRequired().HasColumnType("char(64)").HasColumnName("hashSHA256");
}

b.Property<string>("Key")
.IsRequired()
.HasColumnType("varchar(20)");

b.Property<string>("HashMD5")
.IsRequired()
.HasColumnName("hashMD5")
.HasColumnType(GamesContext.CharColumnTypeFromProvider(ContextSnapshotHelper.DBKind,
"char(32)", "char(32)", "character(32)", "char(32)", "char(32)"
));

b.Property<string>("HashSHA256")
.IsRequired()
.HasColumnName("hashSHA256")
.HasColumnType(GamesContext.CharColumnTypeFromProvider(ContextSnapshotHelper.DBKind,
"char(64)", "char(64)", "character(64)", "char(64)", "char(64)"
));

b.HasKey("Key");

b.ToTable("Hashes");
Expand Down

0 comments on commit 52ac875

Please sign in to comment.