diff --git a/src/StreetNameRegistry.Projections.Integration/Migrations/20240429094617_CombinedIndexIsRemovedStatus.Designer.cs b/src/StreetNameRegistry.Projections.Integration/Migrations/20240429094617_CombinedIndexIsRemovedStatus.Designer.cs new file mode 100644 index 000000000..699277340 --- /dev/null +++ b/src/StreetNameRegistry.Projections.Integration/Migrations/20240429094617_CombinedIndexIsRemovedStatus.Designer.cs @@ -0,0 +1,282 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using StreetNameRegistry.Projections.Integration; + +#nullable disable + +namespace StreetNameRegistry.Projections.Integration.Migrations +{ + [DbContext(typeof(IntegrationContext))] + [Migration("20240429094617_CombinedIndexIsRemovedStatus")] + partial class CombinedIndexIsRemovedStatus + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Be.Vlaanderen.Basisregisters.ProjectionHandling.Runner.ProjectionStates.ProjectionStateItem", b => + { + b.Property("Name") + .HasColumnType("text"); + + b.Property("DesiredState") + .HasColumnType("text"); + + b.Property("DesiredStateChangedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ErrorMessage") + .HasColumnType("text"); + + b.Property("Position") + .HasColumnType("bigint"); + + b.HasKey("Name"); + + b.ToTable("ProjectionStates", "integration_streetname"); + }); + + modelBuilder.Entity("StreetNameRegistry.Projections.Integration.StreetNameLatestItem", b => + { + b.Property("PersistentLocalId") + .ValueGeneratedOnAdd() + .HasColumnType("integer") + .HasColumnName("persistent_local_id"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("PersistentLocalId")); + + b.Property("HomonymAdditionDutch") + .HasColumnType("text") + .HasColumnName("homonym_addition_dutch"); + + b.Property("HomonymAdditionEnglish") + .HasColumnType("text") + .HasColumnName("homonym_addition_english"); + + b.Property("HomonymAdditionFrench") + .HasColumnType("text") + .HasColumnName("homonym_addition_french"); + + b.Property("HomonymAdditionGerman") + .HasColumnType("text") + .HasColumnName("homonym_addition_german"); + + b.Property("IsRemoved") + .HasColumnType("boolean") + .HasColumnName("is_removed"); + + b.Property("MunicipalityId") + .HasColumnType("uuid") + .HasColumnName("municipality_id"); + + b.Property("NameDutch") + .HasColumnType("text") + .HasColumnName("name_dutch"); + + b.Property("NameEnglish") + .HasColumnType("text") + .HasColumnName("name_english"); + + b.Property("NameFrench") + .HasColumnType("text") + .HasColumnName("name_french"); + + b.Property("NameGerman") + .HasColumnType("text") + .HasColumnName("name_german"); + + b.Property("Namespace") + .IsRequired() + .HasColumnType("text") + .HasColumnName("namespace"); + + b.Property("NisCode") + .HasColumnType("text") + .HasColumnName("nis_code"); + + b.Property("OsloStatus") + .IsRequired() + .HasColumnType("text") + .HasColumnName("oslo_status"); + + b.Property("Puri") + .IsRequired() + .HasColumnType("text") + .HasColumnName("puri"); + + b.Property("Status") + .HasColumnType("integer") + .HasColumnName("status"); + + b.Property("VersionAsString") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version_as_string"); + + b.Property("VersionTimestampAsDateTimeOffset") + .HasColumnType("timestamp with time zone") + .HasColumnName("version_timestamp"); + + b.HasKey("PersistentLocalId") + .HasAnnotation("SqlServer:Clustered", true); + + b.HasIndex("IsRemoved"); + + b.HasIndex("MunicipalityId"); + + b.HasIndex("NameDutch"); + + b.HasIndex("NameEnglish"); + + b.HasIndex("NameFrench"); + + b.HasIndex("NameGerman"); + + b.HasIndex("NisCode"); + + b.HasIndex("OsloStatus"); + + b.HasIndex("PersistentLocalId"); + + b.HasIndex("Status"); + + b.HasIndex("IsRemoved", "Status"); + + b.ToTable("streetname_latest_items", "integration_streetname"); + }); + + modelBuilder.Entity("StreetNameRegistry.Projections.Integration.StreetNameVersion", b => + { + b.Property("Position") + .HasColumnType("bigint") + .HasColumnName("position"); + + b.Property("PersistentLocalId") + .HasColumnType("integer") + .HasColumnName("persistent_local_id"); + + b.Property("CreatedOnAsString") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedOnTimestampAsDateTimeOffset") + .HasColumnType("timestamp with time zone") + .HasColumnName("created_on_timestamp"); + + b.Property("HomonymAdditionDutch") + .HasColumnType("text") + .HasColumnName("homonym_addition_dutch"); + + b.Property("HomonymAdditionEnglish") + .HasColumnType("text") + .HasColumnName("homonym_addition_english"); + + b.Property("HomonymAdditionFrench") + .HasColumnType("text") + .HasColumnName("homonym_addition_french"); + + b.Property("HomonymAdditionGerman") + .HasColumnType("text") + .HasColumnName("homonym_addition_german"); + + b.Property("IsRemoved") + .HasColumnType("boolean") + .HasColumnName("is_removed"); + + b.Property("MunicipalityId") + .HasColumnType("uuid") + .HasColumnName("municipality_id"); + + b.Property("NameDutch") + .HasColumnType("text") + .HasColumnName("name_dutch"); + + b.Property("NameEnglish") + .HasColumnType("text") + .HasColumnName("name_english"); + + b.Property("NameFrench") + .HasColumnType("text") + .HasColumnName("name_french"); + + b.Property("NameGerman") + .HasColumnType("text") + .HasColumnName("name_german"); + + b.Property("Namespace") + .IsRequired() + .HasColumnType("text") + .HasColumnName("namespace"); + + b.Property("NisCode") + .HasColumnType("text") + .HasColumnName("nis_code"); + + b.Property("OsloStatus") + .HasColumnType("text") + .HasColumnName("oslo_status"); + + b.Property("Puri") + .IsRequired() + .HasColumnType("text") + .HasColumnName("puri"); + + b.Property("Status") + .HasColumnType("integer") + .HasColumnName("status"); + + b.Property("StreetNameId") + .HasColumnType("uuid") + .HasColumnName("streetname_id"); + + b.Property("Type") + .IsRequired() + .HasColumnType("text") + .HasColumnName("type"); + + b.Property("VersionAsString") + .IsRequired() + .HasColumnType("text") + .HasColumnName("version_as_string"); + + b.Property("VersionTimestampAsDateTimeOffset") + .HasColumnType("timestamp with time zone") + .HasColumnName("version_timestamp"); + + b.HasKey("Position", "PersistentLocalId"); + + b.HasIndex("IsRemoved"); + + b.HasIndex("MunicipalityId"); + + b.HasIndex("NisCode"); + + b.HasIndex("OsloStatus"); + + b.HasIndex("PersistentLocalId"); + + b.HasIndex("Status"); + + b.HasIndex("StreetNameId"); + + b.HasIndex("Type"); + + b.HasIndex("VersionTimestampAsDateTimeOffset"); + + b.ToTable("streetname_versions", "integration_streetname"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/StreetNameRegistry.Projections.Integration/Migrations/20240429094617_CombinedIndexIsRemovedStatus.cs b/src/StreetNameRegistry.Projections.Integration/Migrations/20240429094617_CombinedIndexIsRemovedStatus.cs new file mode 100644 index 000000000..b3674dc24 --- /dev/null +++ b/src/StreetNameRegistry.Projections.Integration/Migrations/20240429094617_CombinedIndexIsRemovedStatus.cs @@ -0,0 +1,29 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace StreetNameRegistry.Projections.Integration.Migrations +{ + /// + public partial class CombinedIndexIsRemovedStatus : Migration + { + /// + 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" }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_streetname_latest_items_is_removed_status", + schema: "integration_streetname", + table: "streetname_latest_items"); + } + } +} diff --git a/src/StreetNameRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs b/src/StreetNameRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs index 2a5af6beb..3d73a441b 100644 --- a/src/StreetNameRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs +++ b/src/StreetNameRegistry.Projections.Integration/Migrations/IntegrationContextModelSnapshot.cs @@ -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); @@ -148,6 +148,8 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasIndex("Status"); + b.HasIndex("IsRemoved", "Status"); + b.ToTable("streetname_latest_items", "integration_streetname"); }); diff --git a/src/StreetNameRegistry.Projections.Integration/StreetNameLatestItem.cs b/src/StreetNameRegistry.Projections.Integration/StreetNameLatestItem.cs index 1a0ffc0e0..a03d2e751 100644 --- a/src/StreetNameRegistry.Projections.Integration/StreetNameLatestItem.cs +++ b/src/StreetNameRegistry.Projections.Integration/StreetNameLatestItem.cs @@ -96,6 +96,7 @@ public void Configure(EntityTypeBuilder builder) builder.HasIndex(x => x.NameFrench); builder.HasIndex(x => x.NameGerman); builder.HasIndex(x => x.IsRemoved); + builder.HasIndex(x => new { x.IsRemoved, x.Status }); } } }