fix(data): drop unique index on lists.name (allow duplicate list names)

The startup-race hardening added a global unique index on lists.name, but
duplicate list names are legitimate and the index broke 8 Worker tests that
seed same-named lists. The seeder race is already handled by the atomic
INSERT...WHERE NOT EXISTS, so the index is redundant. Keep the de-dup migration
step, remove the unique index from config, migration and model snapshot.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-06-09 10:15:42 +02:00
parent 61a40d549b
commit f5d165baae
4 changed files with 0 additions and 18 deletions

View File

@@ -19,7 +19,6 @@ public class ListEntityConfiguration : IEntityTypeConfiguration<ListEntity>
builder.Property(l => l.SortOrder).HasColumnName("sort_order").IsRequired().HasDefaultValue(0);
builder.HasIndex(l => l.SortOrder).HasDatabaseName("idx_lists_sort");
builder.HasIndex(l => l.Name).IsUnique().HasDatabaseName("idx_lists_name");
builder.HasOne(l => l.Config)
.WithOne(c => c.List)

View File

@@ -214,10 +214,6 @@ namespace ClaudeDo.Data.Migrations
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasDatabaseName("idx_lists_name");
b.HasIndex("SortOrder")
.HasDatabaseName("idx_lists_sort");

View File

@@ -20,20 +20,11 @@ namespace ClaudeDo.Data.Migrations
SELECT MIN(l2.rowid) FROM lists l2 WHERE l2.name = lists.name
)
""");
migrationBuilder.CreateIndex(
name: "idx_lists_name",
table: "lists",
column: "name",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "idx_lists_name",
table: "lists");
}
}
}

View File

@@ -211,10 +211,6 @@ namespace ClaudeDo.Data.Migrations
b.HasKey("Id");
b.HasIndex("Name")
.IsUnique()
.HasDatabaseName("idx_lists_name");
b.HasIndex("SortOrder")
.HasDatabaseName("idx_lists_sort");