refactor(bootstrap): finalize load-index migration; GlobalsImporter is now a stub
Stage 9C of the bootstrap-seed-refactor: - Add 6 seed DTOs for the card-id-keyed load-index tables (SpotCard, ReprintedCard, UnlimitedRestriction, LoadingExclusionCard, MaintenanceCard, FeatureMaintenance). - Add CardListsImporter: idempotent upsert of the 6 tables, sharing one Cards FK set for orphan-warning. FeatureMaintenances clear-and-rewrites (synthetic ordinal Id; no natural key). - Add RotationFlagUpdater: reads RotationConfig.RotationCardSetIds from the GameConfigs section (populated by RotationConfigImporter) and flips CardSet.IsInRotation to match. - Add RotationConfig.RotationCardSetIds list property + wire it through RotationConfigImporter. No migration needed (sections are JSON blobs). - RotationConfigImporter: use legacy local-kind DateTime parse for schedule windows so the JSON round-trip stays byte-equivalent to GlobalsImporter. - Strip GlobalsImporter down to a no-op stub (Task 10 will delete it). - Wire all 9 new importers into Program.cs and SVSimTestFactory.SeedGlobalsAsync, in the order RotationConfigImporter -> ... -> CardListsImporter -> RotationFlagUpdater. - Delete prod-captures/load-index-2026-05-23.json. - Add CardListsImporterTests covering each sub-table, idempotency, empty-seed handling, orphan-warning, and the clear-and-rewrite path. Tests: 391 passing (382 baseline + 9 new). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
16
SVSim.Bootstrap/Models/Seed/FeatureMaintenanceSeed.cs
Normal file
16
SVSim.Bootstrap/Models/Seed/FeatureMaintenanceSeed.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors one entry of <c>seeds/feature-maintenances.json</c>. Source: <c>/load/index
|
||||
/// data.feature_maintenance_list</c> (array of dicts; usually empty). <see cref="Data"/> is
|
||||
/// the raw element so it round-trips verbatim into the entity's jsonb column.
|
||||
/// </summary>
|
||||
public sealed class FeatureMaintenanceSeed
|
||||
{
|
||||
[JsonPropertyName("id")] public int Id { get; set; }
|
||||
[JsonPropertyName("feature_key")] public string FeatureKey { get; set; } = "";
|
||||
[JsonPropertyName("data")] public JsonElement Data { get; set; }
|
||||
}
|
||||
12
SVSim.Bootstrap/Models/Seed/LoadingExclusionCardSeed.cs
Normal file
12
SVSim.Bootstrap/Models/Seed/LoadingExclusionCardSeed.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors one entry of <c>seeds/loading-exclusion-cards.json</c>. Source: <c>/load/index
|
||||
/// data.loading_exclusion_card_list</c> (array of card_ids).
|
||||
/// </summary>
|
||||
public sealed class LoadingExclusionCardSeed
|
||||
{
|
||||
[JsonPropertyName("card_id")] public long CardId { get; set; }
|
||||
}
|
||||
12
SVSim.Bootstrap/Models/Seed/MaintenanceCardSeed.cs
Normal file
12
SVSim.Bootstrap/Models/Seed/MaintenanceCardSeed.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors one entry of <c>seeds/maintenance-cards.json</c>. Source: <c>/load/index
|
||||
/// data.maintenance_card_list</c> (array of card_ids; usually empty).
|
||||
/// </summary>
|
||||
public sealed class MaintenanceCardSeed
|
||||
{
|
||||
[JsonPropertyName("card_id")] public long CardId { get; set; }
|
||||
}
|
||||
12
SVSim.Bootstrap/Models/Seed/ReprintedCardSeed.cs
Normal file
12
SVSim.Bootstrap/Models/Seed/ReprintedCardSeed.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors one entry of <c>seeds/reprinted-cards.json</c>. Source: <c>/load/index
|
||||
/// data.reprinted_base_card_ids</c> (dict or list of card_ids).
|
||||
/// </summary>
|
||||
public sealed class ReprintedCardSeed
|
||||
{
|
||||
[JsonPropertyName("card_id")] public long CardId { get; set; }
|
||||
}
|
||||
13
SVSim.Bootstrap/Models/Seed/SpotCardSeed.cs
Normal file
13
SVSim.Bootstrap/Models/Seed/SpotCardSeed.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors one entry of <c>seeds/spot-cards.json</c>. Source: <c>/load/index data.spot_cards</c>
|
||||
/// — extractor reshapes the wire dict {card_id: cost} into a list of {card_id, cost} rows.
|
||||
/// </summary>
|
||||
public sealed class SpotCardSeed
|
||||
{
|
||||
[JsonPropertyName("card_id")] public long CardId { get; set; }
|
||||
[JsonPropertyName("cost")] public int Cost { get; set; }
|
||||
}
|
||||
13
SVSim.Bootstrap/Models/Seed/UnlimitedRestrictionSeed.cs
Normal file
13
SVSim.Bootstrap/Models/Seed/UnlimitedRestrictionSeed.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SVSim.Bootstrap.Models.Seed;
|
||||
|
||||
/// <summary>
|
||||
/// Mirrors one entry of <c>seeds/unlimited-restrictions.json</c>. Source: <c>/load/index
|
||||
/// data.unlimited_restricted_base_card_id_list</c> (dict {card_id: restriction_value}).
|
||||
/// </summary>
|
||||
public sealed class UnlimitedRestrictionSeed
|
||||
{
|
||||
[JsonPropertyName("card_id")] public long CardId { get; set; }
|
||||
[JsonPropertyName("restriction_value")] public int RestrictionValue { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user