Skip to content

PgExclusion: the 5.x reader, and a 5.x snapshot with exclusion constraints hands over with no operations #92

Closed

Description

@CaffeinatedCoder

The exclusion half of spike C (#18) and the last "done when" of #25 (plan, section 3.13).

Problem

A project that comes from EFCore.ComplexIndexes 5.x has a model snapshot that holds its exclusion constraints as 5.x wrote them: one annotation CustomExclusion:Constraints per entity type, a JSON list. SchemaKit's planner reads only its own annotations. So the first migrations add after the move sees no constraint in the snapshot and every constraint in the model, and writes an ADD CONSTRAINT for each one. Without 5.x's DROP CONSTRAINT IF EXISTS in front that fails at apply (42P07); a consumer who deletes the statements by hand to get past it has a snapshot nothing checked.

Change

  • The kernel gets the seam: a reader for an annotation of another format, registered like a contributor, asked for the source side of a diff only. A model that still carries such an annotation where the migration leads is refused.
  • The PostgreSQL package reads CustomExclusion:Constraints into PgExclusion declarations, which are then resolved like any other. What 5.x could store and PgExclusion cannot say is refused by name, never dropped.
  • A fixture scaffolded by the published 5.6.0 packages on net10.0 (snapshot and migration, checked in with the script that makes them), and the same model declared with SchemaKit.

Done when

  • The 5.x snapshot against the SchemaKit model is no operations, offline.
  • On PostgreSQL 16 and 18: the 5.x migration is applied as scaffolded, the diff is still empty, and the catalog holds what EnsureCreated() builds for the SchemaKit model.
  • A difference between the two (a filter, a name) is a rebuild or a rename, shown by a test, not an empty diff.
  • Each refusal has a test, and each guard is shown to fail without what it guards.

The temporal half of #18 (a constraint moved to WithoutOverlaps(), the handover matcher) stays with #18.

Activity

  1. added this to the 11.0.0 milestone on Nov 12, 2026
  2. added
    enhancement
    package/core
    package/postgresql
    area/constraints
    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/constraintsenhancementpackage/corepackage/postgresql

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions