Path: redb/redb.Tests.Integration/Models/MigrationTargetProbeModels.cs Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Tests.Integration/Models/MigrationTargetProbeModels.cs ---- using redb.Core.Attributes; using redb.Core.Pro.Migration; namespace redb.Tests.Integration.Models; /// /// Probes how the migration DSL ADDRESSES a field that is not a root scheme field: a member of a /// nested class and a member of an array element. /// /// Written for review finding PR-32, which states that the compiled migration SQL correlates the /// source subquery by object id and structure id only, carrying neither _array_index nor /// _parent_value_id. That finding only bites if such a target is reachable through the DSL /// at all, so this suite establishes reachability first and records the observed behaviour. /// /// /// Field names are deliberately distinct between levels (GrandTotal at the root, /// LineTotal inside) so a DSL that flattens a dotted path to its leaf name cannot silently /// resolve to the root field of the same shape. /// /// [RedbScheme("Миграции: вложенная цель", Name = "migration_target_probe")] public class MigrationTargetProbeProps { public double Base { get; set; } public double Multiplier { get; set; } public double GrandTotal { get; set; } public LineTargetProps? Details { get; set; } public List Items { get; set; } = new(); } /// Nested (non-array) member and the array element member. public class LineTargetProps { public double Qty { get; set; } public double Price { get; set; } public double LineTotal { get; set; } } /// Control: both target and sources are ROOT fields — the shape every existing migration test uses. public class MigrationTargetRootMigration : IRedbMigration { public void Configure(IMigrationBuilder builder) { builder.Property(p => p.GrandTotal) .ComputedFrom(p => p.Base * p.Multiplier); } } /// Nested-class target and nested sources. public class MigrationTargetNestedMigration : IRedbMigration { public void Configure(IMigrationBuilder builder) { builder.Property(p => p.Details!.LineTotal) .ComputedFrom(p => p.Details!.Qty * p.Details!.Price); } } /// Array-element target and array-element sources. public class MigrationTargetArrayMigration : IRedbMigration { public void Configure(IMigrationBuilder builder) { builder.Property(p => p.Items[0].LineTotal) .ComputedFrom(p => p.Items[0].Qty * p.Items[0].Price); } }