Add critical result curation metadata
This commit is contained in:
@@ -79,6 +79,7 @@ public sealed class RolemasterDbContext(DbContextOptions<RolemasterDbContext> op
|
||||
{
|
||||
entity.HasIndex(item => new { item.CriticalTableId, item.CriticalGroupId, item.CriticalColumnId, item.CriticalRollBandId }).IsUnique();
|
||||
entity.Property(item => item.ParseStatus).HasMaxLength(32);
|
||||
entity.Property(item => item.SourceImagePath).HasMaxLength(512);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<CriticalBranch>(entity =>
|
||||
|
||||
@@ -8,6 +8,7 @@ public static class RolemasterDbSchemaUpgrader
|
||||
public static async Task EnsureLatestAsync(RolemasterDbContext dbContext, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await EnsureAttackTableFumbleColumnsAsync(dbContext, cancellationToken);
|
||||
await EnsureCriticalResultCurationColumnsAsync(dbContext, cancellationToken);
|
||||
|
||||
await dbContext.Database.ExecuteSqlRawAsync(
|
||||
"""
|
||||
@@ -91,6 +92,49 @@ public static class RolemasterDbSchemaUpgrader
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
private static async Task EnsureCriticalResultCurationColumnsAsync(RolemasterDbContext dbContext, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!await ColumnExistsAsync(dbContext, "CriticalResults", "IsCurated", cancellationToken))
|
||||
{
|
||||
await dbContext.Database.ExecuteSqlRawAsync(
|
||||
"""
|
||||
ALTER TABLE "CriticalResults"
|
||||
ADD COLUMN "IsCurated" INTEGER NOT NULL DEFAULT 0;
|
||||
""",
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
if (!await ColumnExistsAsync(dbContext, "CriticalResults", "SourcePageNumber", cancellationToken))
|
||||
{
|
||||
await dbContext.Database.ExecuteSqlRawAsync(
|
||||
"""
|
||||
ALTER TABLE "CriticalResults"
|
||||
ADD COLUMN "SourcePageNumber" INTEGER NULL;
|
||||
""",
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
if (!await ColumnExistsAsync(dbContext, "CriticalResults", "SourceImagePath", cancellationToken))
|
||||
{
|
||||
await dbContext.Database.ExecuteSqlRawAsync(
|
||||
"""
|
||||
ALTER TABLE "CriticalResults"
|
||||
ADD COLUMN "SourceImagePath" TEXT NULL;
|
||||
""",
|
||||
cancellationToken);
|
||||
}
|
||||
|
||||
if (!await ColumnExistsAsync(dbContext, "CriticalResults", "SourceImageCropJson", cancellationToken))
|
||||
{
|
||||
await dbContext.Database.ExecuteSqlRawAsync(
|
||||
"""
|
||||
ALTER TABLE "CriticalResults"
|
||||
ADD COLUMN "SourceImageCropJson" TEXT NULL;
|
||||
""",
|
||||
cancellationToken);
|
||||
}
|
||||
}
|
||||
|
||||
private static async Task EnsureAttackTableFumbleColumnsAsync(RolemasterDbContext dbContext, CancellationToken cancellationToken)
|
||||
{
|
||||
if (!await ColumnExistsAsync(dbContext, "AttackTables", "FumbleMinRoll", cancellationToken))
|
||||
|
||||
@@ -7,11 +7,15 @@ public sealed class CriticalResult
|
||||
public int? CriticalGroupId { get; set; }
|
||||
public int CriticalColumnId { get; set; }
|
||||
public int CriticalRollBandId { get; set; }
|
||||
public bool IsCurated { get; set; }
|
||||
public string RawCellText { get; set; } = string.Empty;
|
||||
public string DescriptionText { get; set; } = string.Empty;
|
||||
public string? RawAffixText { get; set; }
|
||||
public string ParsedJson { get; set; } = "{}";
|
||||
public string ParseStatus { get; set; } = "verified";
|
||||
public int? SourcePageNumber { get; set; }
|
||||
public string? SourceImagePath { get; set; }
|
||||
public string? SourceImageCropJson { get; set; }
|
||||
public CriticalTable CriticalTable { get; set; } = null!;
|
||||
public CriticalGroup? CriticalGroup { get; set; }
|
||||
public CriticalColumn CriticalColumn { get; set; } = null!;
|
||||
|
||||
Reference in New Issue
Block a user