- 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>
33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using ClaudeDo.Data;
|
|
using ClaudeDo.Installer.Core;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ClaudeDo.Installer.Steps;
|
|
|
|
public sealed class InitDatabaseStep : IInstallStep
|
|
{
|
|
public string Name => "Initialize Database";
|
|
|
|
public Task<StepResult> ExecuteAsync(InstallContext ctx, IProgress<string> progress, CancellationToken ct)
|
|
{
|
|
try
|
|
{
|
|
var expandedPath = Paths.Expand(ctx.DbPath);
|
|
progress.Report($"Initializing database at {expandedPath}");
|
|
|
|
var options = new DbContextOptionsBuilder<ClaudeDoDbContext>()
|
|
.UseSqlite($"Data Source={expandedPath}")
|
|
.Options;
|
|
using var context = new ClaudeDoDbContext(options);
|
|
ClaudeDoDbContext.MigrateAndConfigure(context);
|
|
|
|
progress.Report("Schema applied successfully");
|
|
return Task.FromResult(StepResult.Ok());
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
return Task.FromResult(StepResult.Fail(ex.Message));
|
|
}
|
|
}
|
|
}
|