fix(data): address code review findings
- Fix sort order regression in GetByListIdAsync (was descending, should be ascending) - Restore WAL mode pragma (was silently dropped in EF migration) - Add existing-DB compatibility shim in MigrateAndConfigure (baselines InitialCreate migration for databases created by the old schema.sql) - Remove dead AddDbContext/AddScoped registrations from Worker (only IDbContextFactory is used by singleton consumers) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -17,16 +17,8 @@ builder.Host.UseWindowsService(o => o.ServiceName = "ClaudeDoWorker");
|
||||
|
||||
builder.Services.AddDbContextFactory<ClaudeDoDbContext>(opt =>
|
||||
opt.UseSqlite($"Data Source={cfg.DbPath}"));
|
||||
builder.Services.AddDbContext<ClaudeDoDbContext>(opt =>
|
||||
opt.UseSqlite($"Data Source={cfg.DbPath}"));
|
||||
|
||||
builder.Services.AddSingleton(cfg);
|
||||
builder.Services.AddScoped<TagRepository>();
|
||||
builder.Services.AddScoped<ListRepository>();
|
||||
builder.Services.AddScoped<TaskRepository>();
|
||||
builder.Services.AddScoped<SubtaskRepository>();
|
||||
builder.Services.AddScoped<WorktreeRepository>();
|
||||
builder.Services.AddScoped<TaskRunRepository>();
|
||||
builder.Services.AddHostedService<StaleTaskRecovery>();
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
@@ -54,7 +46,8 @@ var app = builder.Build();
|
||||
|
||||
using (var scope = app.Services.CreateScope())
|
||||
{
|
||||
scope.ServiceProvider.GetRequiredService<ClaudeDoDbContext>().Database.Migrate();
|
||||
ClaudeDoDbContext.MigrateAndConfigure(
|
||||
scope.ServiceProvider.GetRequiredService<ClaudeDoDbContext>());
|
||||
}
|
||||
|
||||
app.MapHub<WorkerHub>("/hub");
|
||||
|
||||
Reference in New Issue
Block a user