Skip to content

Commit 274166a

Browse files
committed
Reintroduce morph-type seeding to minimize fix-diff
1 parent 01fed0f commit 274166a

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

backend/FwLite/LcmCrdt.Tests/MiniLcmApiFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ public async Task InitializeAsync(string projectName, Guid? projectId = null)
7575
await _crdtDbContext.Database.OpenConnectionAsync();
7676
//can't use ProjectsService.CreateProject because it opens and closes the db context, this would wipe out the in memory db.
7777
var projectData = new ProjectData("Sena 3", projectName, projectId ?? Guid.NewGuid(), null, Guid.NewGuid());
78-
await CrdtProjectsService.InitProjectDb(_crdtDbContext,
79-
projectData);
80-
await currentProjectService.RefreshProjectData();
78+
await CrdtProjectsService.InitProjectDb(_crdtDbContext, projectData);
79+
// Also trigger "data migrations" that CreateProject runs
80+
await currentProjectService.SetupProjectContext(crdtProject);
8181
if (_seedWs)
8282
{
8383
await Api.CreateWritingSystem(new WritingSystem()

backend/FwLite/LcmCrdt/CrdtProjectsService.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ public virtual async Task<CrdtProject> CreateProject(CreateProjectRequest reques
170170
if (request.SeedNewProjectData)
171171
await SeedSystemData(dataModel, projectData);
172172
await (request.AfterCreate?.Invoke(serviceScope.ServiceProvider, crdtProject) ?? Task.CompletedTask);
173+
// Ensure "data migrations" are executed on project creation (e.g. seeding morph types)
174+
// These should happen AFTER the initial download, so they can be run conditionally based on
175+
// the current state of the project.
176+
await currentProjectService.SetupProjectContext(crdtProject);
173177
}
174178
catch (Exception e)
175179
{

0 commit comments

Comments
 (0)