Skip to content

Planner, second slice: EF Core's operations as BaseChange, ImpactOf asked and acted on, and an unknown operation type refused #65

Closed

Description

@CaffeinatedCoder

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

Problem

The planner (#63) compares the declarations of two models and does not look at what EF Core does between them. An object both models declare unchanged is left alone, also when an operation of EF Core's removes it (SQLite's table rebuild, a dropped column under raw SQL) or cannot run while it exists (SQL Server's ALTER COLUMN under an index). The first is a migration that applies cleanly and leaves the database without what the model declares.

Change

  • EF Core's operations become BaseChanges. A table of every MigrationOperation type in EF Core Relational and the three providers maps each to a change or marks it harmless. On SQLite an operation the provider rebuilds the table for is also TableRebuilt.
  • An operation type outside the table is refused when either model declares a SchemaKit object: what it does to them is unknown.
  • ImpactOf is asked for every source descriptor and every change that touches what it depends on (a column, the whole table, its scope), and the worst answer decides:
    • RebuildAround: dropped before EF Core's operations and created after them, also when both sides are equal. Plan is not asked.
    • Lost: not dropped; created after when the target still declares it.
    • Follows and Unaffected: as before.
  • A table EF Core renames is the same table for this: a change on the renamed table reaches a descriptor that names the old one.

Not in this slice (stays in #24)

Done when

  • On a live SQLite database, an index both models declare is still there after a migration whose AlterColumn rebuilt the table.
  • A convention test fails when an assembly gains a MigrationOperation type the table does not know, and another when SQLite rebuilds a table for an operation the kernel does not take for one.
  • 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