refactor(installer): switch InitDatabaseStep to EF Core migrations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-16 09:01:50 +02:00
parent 36484ed45a
commit 7d0ca45a60

View File

@@ -1,5 +1,6 @@
using ClaudeDo.Data; using ClaudeDo.Data;
using ClaudeDo.Installer.Core; using ClaudeDo.Installer.Core;
using Microsoft.EntityFrameworkCore;
namespace ClaudeDo.Installer.Steps; namespace ClaudeDo.Installer.Steps;
@@ -14,8 +15,11 @@ public sealed class InitDatabaseStep : IInstallStep
var expandedPath = Paths.Expand(ctx.DbPath); var expandedPath = Paths.Expand(ctx.DbPath);
progress.Report($"Initializing database at {expandedPath}"); progress.Report($"Initializing database at {expandedPath}");
var factory = new SqliteConnectionFactory(expandedPath); var options = new DbContextOptionsBuilder<ClaudeDoDbContext>()
SchemaInitializer.Apply(factory); .UseSqlite($"Data Source={expandedPath}")
.Options;
using var context = new ClaudeDoDbContext(options);
context.Database.Migrate();
progress.Report("Schema applied successfully"); progress.Report("Schema applied successfully");
return Task.FromResult(StepResult.Ok()); return Task.FromResult(StepResult.Ok());