Skip to content

Commit

Permalink
Added proper filter on index
Browse files Browse the repository at this point in the history
  • Loading branch information
Fargekritt committed Jan 17, 2025
1 parent 3e66899 commit 9f846c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public void Configure(EntityTypeBuilder<DialogEntity> builder)
builder.HasIndex(x => x.Party);
builder.HasIndex(x => x.Process);
builder.Property(x => x.IdempotentKey).HasMaxLength(36);
builder.HasIndex(x => new { x.Org, x.IdempotentKey }).IsUnique().HasFilter(null);
builder.HasIndex(x => new { x.Org, x.IdempotentKey }).IsUnique().HasFilter($"\"{nameof(DialogEntity.IdempotentKey)}\" is not null");
}
}

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
Expand Up @@ -21,7 +21,8 @@ protected override void Up(MigrationBuilder migrationBuilder)
name: "IX_Dialog_Org_IdempotentKey",
table: "Dialog",
columns: new[] { "Org", "IdempotentKey" },
unique: true);
unique: true,
filter: "\"IdempotentKey\" is not null");
}

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
b.HasIndex("UpdatedAt");

b.HasIndex("Org", "IdempotentKey")
.IsUnique();
.IsUnique()
.HasFilter("\"IdempotentKey\" is not null");

b.ToTable("Dialog", (string)null);
});
Expand Down

0 comments on commit 9f846c7

Please sign in to comment.