Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@
<PackageVersion Include="linq2db" Version="6.2.1" />
<PackageVersion Include="linq2db.EntityFrameworkCore" Version="10.3.0" />
<PackageVersion Include="linq2db.Extensions" Version="6.2.1" />
<PackageVersion Include="EFCore.ComplexIndexes" Version="3.1.5" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
Keys:
Id PK
Annotations:
CustomIndex:CompositeIndexes: [{"paths":["HybridDateTime.DateTime","HybridDateTime.Counter","Id"],"unique":false,"name":"IX_Commits_DateTime_Counter_Id"}]
Relational:FunctionName:
Relational:Schema:
Relational:SqlQuery:
Expand Down
8 changes: 8 additions & 0 deletions src/SIL.Harmony/Db/EntityConfig/CommitEntityConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Text.Json;
using EFCore.ComplexIndexes;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

Expand All @@ -21,6 +22,13 @@ public void Configure(EntityTypeBuilder<Commit> builder)
.HasColumnName("DateTime");
hybridEntity.Property(h => h.Counter).HasColumnName("Counter");
});
// Supports Harmony's DefaultOrder (ASC) directly and DefaultOrderDescending via reverse scan.
// EF Core 10 cannot express indexes mixing ComplexProperty members + scalars (efcore#11336, targeted for 11).
// We use EFCore.ComplexIndexes instead. Both Harmony sorts are uniform-direction, so a single
// ASC index covers both — SQLite and Postgres reverse-scan it for the descending case.
builder.HasComplexCompositeIndex(
c => new { c.HybridDateTime.DateTime, c.HybridDateTime.Counter, c.Id },
indexName: "IX_Commits_DateTime_Counter_Id");
Comment thread
myieye marked this conversation as resolved.
builder.Property(c => c.Metadata)
.HasColumnType("jsonb")
.HasConversion(
Expand Down
1 change: 1 addition & 0 deletions src/SIL.Harmony/SIL.Harmony.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="EFCore.ComplexIndexes" />
<PackageReference Include="Nito.AsyncEx.Coordination" />
</ItemGroup>

Expand Down
Loading