Skip to content

Commit

Permalink
feat: add combined index isremoved and status on integration projections
Browse files Browse the repository at this point in the history
  • Loading branch information
jvandaal authored and ArneD committed Apr 29, 2024
1 parent 2f58f1f commit 3bda9f9
Show file tree
Hide file tree
Showing 4 changed files with 315 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,29 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace StreetNameRegistry.Projections.Integration.Migrations
{
/// <inheritdoc />
public partial class CombinedIndexIsRemovedStatus : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateIndex(
name: "IX_streetname_latest_items_is_removed_status",
schema: "integration_streetname",
table: "streetname_latest_items",
columns: new[] { "is_removed", "status" });
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_streetname_latest_items_is_removed_status",
schema: "integration_streetname",
table: "streetname_latest_items");
}
}
}
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", "6.0.3")
.HasAnnotation("ProductVersion", "8.0.3")
.HasAnnotation("Relational:MaxIdentifierLength", 63);

NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
Expand Down Expand Up @@ -148,6 +148,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)

b.HasIndex("Status");

b.HasIndex("IsRemoved", "Status");

b.ToTable("streetname_latest_items", "integration_streetname");
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ public void Configure(EntityTypeBuilder<StreetNameLatestItem> builder)
builder.HasIndex(x => x.NameFrench);
builder.HasIndex(x => x.NameGerman);
builder.HasIndex(x => x.IsRemoved);
builder.HasIndex(x => new { x.IsRemoved, x.Status });
}
}
}

0 comments on commit 3bda9f9

Please sign in to comment.