Skip to content

SchemaResolver, first slice: property paths and templates to columns and SQL, alike on a model and on its compiled snapshot #58

Closed

Description

@CaffeinatedCoder

The first slice of #43, cut so that the planner (#24) and the exclusion-constraint contributor (#25) have something to resolve with. #43 stays open for the rest.

Problem

SchemaResolver is an abstract shell with Table, Dialect and Sql, and the only implementation is the tests' stand-in. A contributor's Resolve cannot turn a property path or a template into SQL, so no real contributor can be written.

Change

In the kernel, provider-neutral:

  • SchemaResolver.Column(path): a dotted property path to its column in the resolver's table, through the declared property and the table's StoreObjectIdentifier. Complex types are walked; HasColumnName is honoured because the leaf property is asked. One segment past a scalar property (Email.Value) resolves to the whole column only when the property has a converter whose provider type is the member's type; on a snapshot, which rebuilds types as property bags and drops converters, an indexer property is taken as it is.
  • SchemaResolver.Template(sql): SQL with {Path} placeholders, replaced by the delimited column outside single-quoted literals only. A brace pair that is not a property path stays as written.
  • SchemaResolver.Name(declared, prefix, parts): the declared name, or {prefix}_{table}_{tokens}, length-checked by the dialect. A part's token is kept apart from its SQL, so a change of rendering does not rename an object.
  • Every fragment records what it reads: the columns of its placeholders, or the whole table for SQL without one (plan, section 3.7). Composition through SchemaSql.Fragment and SchemaSql.List keeps it.
  • An unknown resolution epoch is refused. Epoch 1 is the only one.
  • The kernel's resolver is made by an internal diff-time service, never a constructor dependency of the differ or the generator.

Not in this slice (stays in #43)

Done when

  • Every kind of path and a template resolve to the same fragment, the same dependencies and the same default name on a configured model and on its generated snapshot compiled with Roslyn, on Npgsql, SQL Server and SQLite.
  • Each rule is shown to fail a test when undone.

Activity

  1. added this to the 11.0.0 milestone on Nov 12, 2026
  2. added
    enhancement
    package/core
    area/migrations
    on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/migrationsenhancementpackage/core

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions