Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions backend/FwLite/LcmCrdt/CurrentProjectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,9 @@ async Task Execute()

// Seed morph-types if missing (for existing projects created before morph-type support).
// Must happen BEFORE FTS regeneration so headwords include morph-type tokens.
// (querying Commits instead of MorphTypes, because the commit may not be projected yet)
var dataModel = services.GetRequiredService<DataModel>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to introduce a version on Project data so that we can only do these kinds of migrations when the version is older. It might not be too bad now, but when we have more of these migrations it'll start to add up quickly, and being able to do a simple comparison against a version number will let us short circuit a lot of checks.

var projectData = await dbContext.ProjectData.AsNoTracking().FirstAsync();
if (!await dbContext.Set<Commit>().AsNoTracking().AnyAsync(c => c.Id == PreDefinedData.MorphTypesSeedCommitId(projectData.Id)))
{
var dataModel = services.GetRequiredService<DataModel>();
await PreDefinedData.AddPredefinedMorphTypes(dataModel, projectData);
}
await PreDefinedData.AddPredefinedMorphTypes(dataModel, projectData);

if (EntrySearchServiceFactory is not null)
{
Expand Down
Loading