refactor(data): centralize list seeding in MigrateAndConfigure, add default-value test

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
mika kuns
2026-04-20 10:07:12 +02:00
parent 92a6e0642e
commit 9a05907170
4 changed files with 21 additions and 4 deletions

View File

@@ -2,7 +2,6 @@ using Avalonia;
using ClaudeDo.Data;
using ClaudeDo.Data.Git;
using ClaudeDo.Data.Repositories;
using ClaudeDo.Data.Seeding;
using ClaudeDo.Ui;
using ClaudeDo.Ui.Services;
using ClaudeDo.Ui.ViewModels;
@@ -31,7 +30,6 @@ sealed class Program
{
var db = scope.ServiceProvider.GetRequiredService<ClaudeDoDbContext>();
ClaudeDoDbContext.MigrateAndConfigure(db);
DefaultListsSeeder.SeedAsync(db).GetAwaiter().GetResult();
}
try

View File

@@ -1,4 +1,5 @@
using ClaudeDo.Data.Models;
using ClaudeDo.Data.Seeding;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage;
@@ -73,5 +74,6 @@ public class ClaudeDoDbContext : DbContext
}
db.Database.Migrate();
DefaultListsSeeder.SeedAsync(db).GetAwaiter().GetResult();
}
}

View File

@@ -1,5 +1,4 @@
using ClaudeDo.Data;
using ClaudeDo.Data.Seeding;
using ClaudeDo.Installer.Core;
using Microsoft.EntityFrameworkCore;
@@ -21,7 +20,6 @@ public sealed class InitDatabaseStep : IInstallStep
.Options;
using var context = new ClaudeDoDbContext(options);
ClaudeDoDbContext.MigrateAndConfigure(context);
DefaultListsSeeder.SeedAsync(context).GetAwaiter().GetResult();
progress.Report("Schema applied successfully");
return Task.FromResult(StepResult.Ok());