Skip to content

Name claims: a name taken twice is reported at the diff, every collision at once #96

Closed

Description

@CaffeinatedCoder

The name-claim part of #44, and the last guard #25 lists (design, section 9.8).

Problem

A contributor answers Claims for each descriptor, and nothing asks. Two objects that take one name are found by the database at apply, in the middle of a migration: an exclusion constraint named like an index anywhere in its schema (its backing index is a relation), or like the table's primary key. Two unnamed declarations that differ only in an option get different keys and the same default name, which the declaration store leaves to this check on purpose.

Change

  • The planner collects the claims of every object the target model declares, and those of EF Core's own tables, indexes, keys, foreign keys, check constraints and sequences. Which namespace a kind of EF Core's occupies is the provider's rule, so the dialect answers it: the kernel's default, and PostgreSQL's (an index is a relation; a primary key and a unique constraint claim a constraint name and a relation name).
  • Two claims of one namespace and one name are a collision when at least one party is SchemaKit's. Names compare by the declaration's rule.
  • Every collision of the model is reported in one SchemaValidationException, each as a SchemaDiagnostic with the id SK1001 and both parties named.
  • Target only: a snapshot that holds a collision stays diffable.

Done when

  • An exclusion constraint named like another table's index, like its table's primary key, and like another exclusion constraint of the same table is each reported with both parties, and the same model fails with 42P07 or 42710 on a live server when the check is switched off.
  • Two findings in one model arrive in one exception.
  • A collision in the snapshot alone does not stop a diff.
  • The seeded defect of Tests the analysis of the first two PgExclusion slices found missing #84 (the constraint's name qualified with its table's schema) fails a test.

Not here, and staying with #44: ids for the kernel's existing refusals, warnings through the diagnostics logger, SQL Server's scopes (they come with its package, #29).

Activity

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

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions