Skip to content

Preserve inherited HiLo sequences in model snapshots - #4031

Merged
roji merged 1 commit into
mainfrom
roji-issue-3613-triage
Oct 18, 2026
Merged

roji merged 1 commit into
mainfrom
roji-issue-3613-triage

Conversation

@roji

@roji roji commented Oct 18, 2026

Copy link
Copy Markdown
Member

Custom model-level HiLo sequences currently generate parameterless property-level UseHiLo() calls in snapshots. Rebuilding the snapshot creates an unwanted default sequence, causing repeated DropSequence migrations and pending-model-change errors.

Fall back to the model's HiLo sequence name and schema when generating property calls, while preserving explicit property overrides and existing model-level behavior. Adds regression coverage for inherited names/schemas and property overrides.

Corresponding SQL Server fix: dotnet/efcore#39325.

Fixes #3613

Resolve property-level HiLo snapshot arguments from model configuration when not explicitly overridden, avoiding spurious sequence drops and pending model changes.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 7c022835-8a88-4ace-928d-d54de023982f
Copilot AI balanced review requested due to automatic review settings October 18, 2026 17:02
@roji
roji enabled auto-merge (squash) October 18, 2026 17:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The localized fix preserves existing behavior, includes focused regression coverage, and has no identified blocking issues.

No open issues 🎉

What changed in this PR

Fixes HiLo snapshot generation to preserve inherited sequence settings, preventing unwanted default sequences and repeated migrations.

Changes:

  • Falls back to model-level HiLo names and schemas while preserving property overrides.
  • Adds regression coverage for inherited settings and explicit overrides.
File Description
test/​EFCore.PG.Tests/​Design/​Internal/​NpgsqlAnnotationCodeGeneratorTest.cs Tests inherited HiLo settings and property overrides.
src/​EFCore.PG/​Design/​Internal/​NpgsqlAnnotationCodeGenerator.cs Adds model-level fallback for property HiLo calls.

Review effort: Balanced

@roji
roji merged commit 12dc421 into main Oct 18, 2026
16 checks passed
@roji
roji deleted the roji-issue-3613-triage branch October 18, 2026 17:16
roji added a commit that referenced this pull request Oct 18, 2026
Backport #4031 to 10.0, preserving inherited model-level HiLo sequence names and schemas in property snapshot calls.

(cherry picked from commit bde0e12)

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 5725ac6e-9b69-43e1-8a39-e7a04e845a83
roji added a commit that referenced this pull request Oct 18, 2026
Backport bde0e12 from #4031 for #3613.

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 373754c9-0387-441e-ad12-c24b8ed792b1
roji added a commit that referenced this pull request Oct 18, 2026
Backport #4031 for #3613. Resolve property-level HiLo snapshot arguments from model configuration while preserving explicit property overrides.

(cherry picked from commit bde0e12)

Co-authored-by: Copilot App <[email protected]>
Copilot-Session: 2cb7624f-a080-43fe-b454-f33de1b9f32d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EF Core continuous migration error with npgsql HiLo

2 participants