Skip to content

Commit f29fa44

Browse files
committed
Refactor index migration
1 parent ff17a15 commit f29fa44

1 file changed

Lines changed: 6 additions & 8 deletions

File tree

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
1-
using Microsoft.EntityFrameworkCore.Migrations;
1+
using Microsoft.EntityFrameworkCore.Migrations;
22

33
#nullable disable
44

55
namespace LcmCrdt.Migrations
66
{
77
/// <inheritdoc />
8+
// Backs harmony's default commit ordering. Hand-written because the index spans a
9+
// ComplexProperty + regular property (efcore#11336). Perhaps move to harmony's fluent API
10+
// via EFCore.ComplexIndexes when we're on .NET 10.
811
public partial class AddCommitsOrderIndex : Migration
912
{
10-
/// <summary>
11-
/// Name of the compound index over <c>(DateTime, Counter, Id)</c> on the <c>Commits</c> table.
12-
/// </summary>
13-
public const string CommitsOrderIndexName = "IX_Commits_DateTime_Counter_Id";
14-
1513
/// <inheritdoc />
1614
protected override void Up(MigrationBuilder migrationBuilder)
1715
{
1816
migrationBuilder.CreateIndex(
19-
name: CommitsOrderIndexName,
17+
name: "IX_Commits_DateTime_Counter_Id",
2018
table: "Commits",
2119
columns: ["DateTime", "Counter", "Id"],
2220
descending: [true, true, true]);
@@ -25,7 +23,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
2523
/// <inheritdoc />
2624
protected override void Down(MigrationBuilder migrationBuilder)
2725
{
28-
migrationBuilder.DropIndex(name: CommitsOrderIndexName, table: "Commits");
26+
migrationBuilder.DropIndex(name: "IX_Commits_DateTime_Counter_Id", table: "Commits");
2927
}
3028
}
3129
}

0 commit comments

Comments
 (0)