db optimizations around names and case-sensitivity (#2749)

* generate (case-insensitive) unique names for fields that should be unique

* move name case-insensitivity down to schema level

* update changelog
This commit is contained in:
Jason Dove
2026-01-02 09:25:23 -06:00
committed by GitHub
parent 80f6e468eb
commit bcd2ea7db3
79 changed files with 29898 additions and 360 deletions
@@ -15,10 +15,8 @@ public class SearchMultiCollectionsHandler(IDbContextFactory<TvContext> dbContex
await using TvContext dbContext = await dbContextFactory.CreateDbContextAsync(cancellationToken);
return await dbContext.MultiCollections
.AsNoTracking()
.Where(c => EF.Functions.Like(
EF.Functions.Collate(c.Name, TvContext.CaseInsensitiveCollation),
$"%{request.Query}%"))
.OrderBy(c => EF.Functions.Collate(c.Name, TvContext.CaseInsensitiveCollation))
.Where(mc => EF.Functions.Like(mc.Name, $"%{request.Query}%"))
.OrderBy(mc => mc.Name)
.Take(10)
.ToListAsync(cancellationToken)
.Map(list => list.Map(ProjectToViewModel).ToList());