Skip to content

Commit 25cffd9

Browse files
committed
Stop specifying commit IDs
1 parent 58399f1 commit 25cffd9

3 files changed

Lines changed: 8 additions & 32 deletions

File tree

backend/FwLite/LcmCrdt/CrdtProjectsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ internal static async Task InitProjectDb(LcmCrdtDbContext db, ProjectData data)
246246

247247
internal static async Task SeedSystemData(DataModel dataModel, ProjectData projectData)
248248
{
249-
await PreDefinedData.AddPredefinedMorphTypes(dataModel, projectData, false);
249+
await PreDefinedData.AddPredefinedMorphTypes(dataModel, projectData);
250250
await PreDefinedData.AddPredefinedComplexFormTypes(dataModel, projectData);
251251
await PreDefinedData.AddPredefinedPartsOfSpeech(dataModel, projectData);
252252
await PreDefinedData.AddPredefinedSemanticDomains(dataModel, projectData);

backend/FwLite/LcmCrdt/CurrentProjectService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ async Task Execute()
114114
var projectData = await dbContext.ProjectData.AsNoTracking().FirstAsync();
115115
if (!await dbContext.MorphTypes.AnyAsync())
116116
{
117-
await PreDefinedData.AddPredefinedMorphTypes(dataModel, projectData, true);
117+
await PreDefinedData.AddPredefinedMorphTypes(dataModel, projectData);
118118
}
119119

120120
if (EntrySearchServiceFactory is not null)

backend/FwLite/LcmCrdt/Objects/PreDefinedData.cs

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using LcmCrdt.Changes;
22
using SIL.Harmony;
3-
using UUIDNext;
43

54
namespace LcmCrdt.Objects;
65

@@ -16,32 +15,13 @@ public static class PreDefinedData
1615
public static readonly Guid AdjectivePartOfSpeechId = new("30d07580-5052-4d91-bc24-469b8b2d7df9");
1716
public static readonly Guid AdverbPartOfSpeechId = new("46e4fe08-ffa0-4c8b-bf98-2c56f38904d9");
1817

19-
// Seed commit-ids are derived per-project (UUIDv5 namespaced on projectId) so each project
20-
// owns its own row in LexBox's CrdtCommits table — a shared constant id would collide on the
21-
// primary key and the seed would get attributed to whichever project pushed first.
22-
public static Guid ComplexFormTypesSeedCommitId(Guid projectId) =>
23-
Uuid.NewNameBased(projectId, "complex-form-types-seed");
24-
25-
public static Guid SemanticDomainsSeedCommitId(Guid projectId) =>
26-
Uuid.NewNameBased(projectId, "semantic-domains-seed");
27-
28-
public static Guid PartsOfSpeechSeedCommitId(Guid projectId) =>
29-
Uuid.NewNameBased(projectId, "parts-of-speech-seed");
30-
31-
public static Guid CustomViewsSeedCommitId(Guid projectId) =>
32-
Uuid.NewNameBased(projectId, "custom-views-seed");
33-
34-
public static Guid MorphTypesSeedCommitId(Guid projectId) =>
35-
Uuid.NewNameBased(projectId, "morph-types-seed");
36-
3718
internal static async Task AddPredefinedComplexFormTypes(DataModel dataModel, ProjectData projectData)
3819
{
3920
await dataModel.AddChanges(projectData.ClientId,
4021
[
4122
new CreateComplexFormType(CompoundComplexFormTypeId, new MultiString() { { "en", "Compound" } } ),
4223
new CreateComplexFormType(UnspecifiedComplexFormTypeId, new MultiString() { { "en", "Unspecified" } })
43-
],
44-
ComplexFormTypesSeedCommitId(projectData.Id));
24+
]);
4525
}
4626

4727
internal static async Task AddPredefinedSemanticDomains(DataModel dataModel, ProjectData projectData)
@@ -56,8 +36,7 @@ await dataModel.AddChanges(projectData.ClientId,
5636
new CreateSemanticDomainChange(new Guid("46e4fe08-ffa0-4c8b-bf88-2c56f38904d4"), new MultiString() { { "en", "Body" } }, "2.1", false),
5737
new CreateSemanticDomainChange(new Guid("46e4fe08-ffa0-4c8b-bf88-2c56f38904d5"), new MultiString() { { "en", "Head" } }, "2.1.1", false),
5838
new CreateSemanticDomainChange(new Guid("46e4fe08-ffa0-4c8b-bf88-2c56f38904d6"), new MultiString() { { "en", "Eye" } }, "2.1.1.1", false),
59-
],
60-
SemanticDomainsSeedCommitId(projectData.Id));
39+
]);
6140
}
6241

6342
public static async Task AddPredefinedPartsOfSpeech(DataModel dataModel, ProjectData projectData)
@@ -69,8 +48,7 @@ await dataModel.AddChanges(projectData.ClientId,
6948
new CreatePartOfSpeechChange(VerbPartOfSpeechId, new MultiString() { { "en", "Verb" } }, true),
7049
new CreatePartOfSpeechChange(AdjectivePartOfSpeechId, new MultiString() { { "en", "Adjective" } }, true),
7150
new CreatePartOfSpeechChange(AdverbPartOfSpeechId, new MultiString() { { "en", "Adverb" } }, true),
72-
],
73-
PartsOfSpeechSeedCommitId(projectData.Id));
51+
]);
7452
}
7553

7654
internal static async Task AddPredefinedCustomViews(DataModel dataModel, ProjectData projectData)
@@ -100,14 +78,12 @@ await dataModel.AddChanges(projectData.ClientId,
10078
Vernacular = [new ViewWritingSystem { WsId = "de" }, new ViewWritingSystem { WsId = "de-Zxxx-x-audio" }],
10179
Analysis = [new ViewWritingSystem { WsId = "en" }]
10280
})
103-
],
104-
CustomViewsSeedCommitId(projectData.Id));
81+
]);
10582
}
10683

107-
internal static async Task AddPredefinedMorphTypes(DataModel dataModel, ProjectData projectData, bool isMigration)
84+
internal static async Task AddPredefinedMorphTypes(DataModel dataModel, ProjectData projectData)
10885
{
10986
await dataModel.AddChanges(projectData.ClientId,
110-
[.. CanonicalMorphTypes.All.Values.Select(mt => new CreateMorphTypeChange(mt))],
111-
isMigration ? Guid.NewGuid() : MorphTypesSeedCommitId(projectData.Id));
87+
[.. CanonicalMorphTypes.All.Values.Select(mt => new CreateMorphTypeChange(mt))]);
11288
}
11389
}

0 commit comments

Comments
 (0)