Skip to content

Planner, first slice: declarations on both sides become descriptors, matched, planned and ordered around EF Core's operations #63

Closed

Description

@CaffeinatedCoder

The first slice of #24, which stays open for the rest.

Problem

The host splices what an ISchemaOperationPlanner returns around the inner differ's operations, and the only planner in the kernel is NoSchemaOperations. A stored declaration never becomes a statement.

Change

SchemaOperationPlanner, internal, replacing NoSchemaOperations:

  • Reads both sides. Every declaration on every entity type of the source and of the target model is read through its contributor and resolved through the kernel's resolver into a descriptor. A declaration whose owner has no contributor is an error (the explicit way out is A declaration for another provider is an error, unless the options ignore that provider #22).
  • Matches (plan, section 3.6): equal descriptors are the same object and produce nothing; the rest are paired on kind, scope and name, then on equality but for the name; what is left is drops and creates.
  • Asks Plan for each pair: None adds nothing, InPlace adds the statements the contributor wrote, Rebuild adds a drop and a create.
  • Orders: drops before EF Core's operations, then in-place statements and creates after them, contributors by their placement. A BeforeTables contributor is the other way round: created before, dropped after.
  • A context with no declaration on either side gets an empty plan without resolving the dialect or a contributor.

Not in this slice (stays in #24)

  • EF Core's operations as BaseChange and ImpactOf: until then a descriptor that reads a renamed column or table differs and is rebuilt, and an object the database loses with an operation of EF Core's while both models declare it unchanged (SQLite's table rebuild) is not re-created.
  • The table of every MigrationOperation type, and the error for one outside it.
  • Ordering by Dependency.SchemaObject between objects.
  • Deleting the tests' stand-in planner in Harness/TestKit.cs, which the host's own tests still use.

Done when

Through the real host, on Npgsql, SQL Server and SQLite: a model against its own compiled snapshot gives no operation; a new, a removed, a renamed and a changed declaration give the statements above in that order; and 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